In this article, we will show you how to copy DPM Recovery Points to Tape using PowerShell.
Table of Contents
Introduction
Tapes have been the definite archive media for many years and will probably continue to be used for this purpose for many years to come. There are many reasons why companies are still using tapes versus the cloud for long-term protection, things like meeting regulatory compliance requirements and security, accommodating backup latency issues, or they are just not ready to move data to the cloud yet.
The protected data by SCDPM can be backed up to disks for short-term retention, to tapes for short-term and long-term retention, and to Microsoft Azure for long-term retention.
In this guide, we will show you how to copy a recovery point from disk to tape for long-term retention. This scenario is useful if you just add a tape library to DPM and you want to copy an old recovery point from disk, or for some reason, your tape library failed, and the long-term backup job did not complete, in this case, you can manually copy your backup to tape after your tape library is back online.
Copy DPM Recovery Points To Tape
With System Center Data Protection Manager, you can copy your data to tape using the DPM Administrator Console by going to the Recovery workspace and then selecting the Copy to tape option as shown in the following screenshot.
Next, you can select the tape library and tape options by choosing whether to Compress, Encrypt, or Do not compress your data on tape.
Now if you want to copy a large number of recovery points to tape, then the UI is not your best option. Luckily, we can automate this process in PowerShell.
Open the Windows PowerShell session on your DPM server and take the following steps:
Connect to the DPM server by running the following command:
Connect-DPMServer -DPMServerName $env:COMPUTERNAME
Then query all your tape libraries attached to DPM by running the following command:
$Library = Get-DPMLibrary
In this example, I have only one tape library.
Query all protection groups and store the results in a variable. You can see their name under the Name column, and, under ProtectionMethod, you can see whether it’s short-term storage using disk, or, in this case, our SQL protection group, using tape for long-term retention.
$PGroup = Get-DPMProtectionGroup
This is an object collection. There is one object in this collection based on what we’re seeing. Bear in mind, in PowerShell syntax, what you could do is type in $PGroup, and if you were to incorporate square brackets, [0], that would refer to the first object in the collection, which, in this case, is the SQL protection group object.
Now, if you want to drill deeper into that protection group and look for recovery points, what you could do is take that further. For example, I will create a new variable named $PObjects, equal to the result of "Get-DPMDatasource"
. So, I will use a different cmdlet here, followed by the parameter -ProtectionGroup
. I am going to refer to the previous variable, $PGroup, and I am interested in the SQL protection group. You can make that reference in this case with square brackets: in this example, it’s [0]. The full syntax will look like the following:
$PObjects = Get-DPMDatasource -ProtectionGroup $PGroup[0]
The next thing I am going to do is see what recovery points are available for that protection group on disk. Again, this is an object collection. There were four objects in this collection based on what we’re seeing. In this example, I am interested in copying DPMDB_SCDPM2016 to tape, so I insert [0] in square brackets; this would refer to the first object in the collection. Finally, I will store the results in a new variable. The full syntax will look like this:
$RPs = Get-DPMRecoveryPoint -Datasource $PObjects[0]
Last, I am going to choose which recovery point I want to copy to tape. Again, this is an object collection. There are 9 recovery points on the disk based on what we’re seeing. In this example, I am interested in copying the oldest recovery point, so I insert [0] in square brackets; this would refer to the first object in the collection. Finally, I will use the Copy-DPMTapeData cmdlet and select the recovery point including the Tape Library and the Tape Options. The full syntax will look like this:
Copy-DPMTapeData -RecoveryPoint $RPs[0] -SourceLibrary $Library[0] `
-TapeLabel "Copy DPM Disk Recovery Point To Tape" `
-TargetLibrary $Library[0] -TapeOption Compress
Now depending on the amount of data you are copying, this operation may take some time. You can also monitor the progress of the job from the DPM console under the Monitoring Workspace. When the job is completed, you can switch to the Management workspace under Libraries, you will see that the disk recovery point is copied to tape as shown in the next screenshot.
PowerShell
You can find below the full PowerShell script that you can use to automate this process.
In this example, we are selecting a specific recovery point that was taken at the beginning of the year.
Connect-DPMServer -DPMServerName $env:COMPUTERNAME
$Library = Get-DPMLibrary
$PGroup = Get-DPMProtectionGroup
$PObjects = Get-DPMDatasource -ProtectionGroup $PGroup[0]
$RPs = Get-DPMRecoveryPoint -Datasource $PObjects[0] | Where-Object {$_.BackupTime -match "01.01.2023"}
Copy-DPMTapeData -RecoveryPoint $RPs[0] -SourceLibrary $Library[0] `
-TapeLabel "Copy DPM Disk Recovery Point To Tape" `
-TargetLibrary $Library[0] -TapeOption Compress
Please note that the same steps above apply whether you are using physical tapes or a virtual tape library, also known as VTL, which could be a hardware appliance or software that you install on your backup server.
Learn: How to add Virtual Tape Library to System Center Data Protection Manager.
That’s it there you have it. Happy Data Protection!
Learn more
Do you want to learn more about System Center Data Protection Manager and how to create a hybrid-cloud backup solution? Make sure to check my recently published book: Microsoft System Center Data Protection Manager Cookbook.
With this book (over 450 pages) on your side, you will master the world of backup with System Center Data Protection Manager and Microsoft Azure Backup Server deployment and management by learning tips, tricks, and best practices, especially when it comes to advanced-level tasks.
__
Thank you for reading my blog.
If you have any questions or feedback, please leave a comment.
-Charbel Nemnom-