Removing DPM Recovery Points from Inactive Protection
Removing DPM Recovery Points from Inactive Protection
C#:
C#:
C#:
C#:
C#:
code:
An annoying limit of SCDPM is its maximum of 9000 recovery points per server (which is a VSS limit it seems). Recently I did a migration of a bunch of protected servers to another DPM server without moving the protected data as well - because that's simply not possible as far as I know. If it is, please let me know.
So anyway: after moving the protected server to another DPM server, the problem is that I can't just throw away the old data. I have to guarantee 2 months of recovery so the data needs to stay on the old DPM server for two months, under a header Inactive protection for previously protected data.
When I wanted to add new protected servers to the DPM server that I moved other protected servers away from, I hit the 9000 recovery points. Blast.
Of course: I have the data of two drives on 22 servers as Inactive protection for previously protected data. That's 22x2x62 = 2728 recovery points. Yikes, these old snapshots are eating about a third of my snapshot capability.
That migration happened about three weeks ago. The problem is that inactive recovery points will not automatically prune just like a recovery point that is part of an active protection group. An idea would be to remove all recovery points that are older than 2 months, which would give me right now 924 available recovery points, enough to add the stuff I need to backup to that same DPM server.
So how do we remove recovery points? Not through the GUI in any case: it only offers the possibility of removing all recovery points for a given data source, not specific points in time. Also, removing 924 recovery points by hand would be quite a tedious job. Automation is the keyword.
Powershell to the rescue!
So anyway: after moving the protected server to another DPM server, the problem is that I can't just throw away the old data. I have to guarantee 2 months of recovery so the data needs to stay on the old DPM server for two months, under a header Inactive protection for previously protected data.
When I wanted to add new protected servers to the DPM server that I moved other protected servers away from, I hit the 9000 recovery points. Blast.
Of course: I have the data of two drives on 22 servers as Inactive protection for previously protected data. That's 22x2x62 = 2728 recovery points. Yikes, these old snapshots are eating about a third of my snapshot capability.
That migration happened about three weeks ago. The problem is that inactive recovery points will not automatically prune just like a recovery point that is part of an active protection group. An idea would be to remove all recovery points that are older than 2 months, which would give me right now 924 available recovery points, enough to add the stuff I need to backup to that same DPM server.
So how do we remove recovery points? Not through the GUI in any case: it only offers the possibility of removing all recovery points for a given data source, not specific points in time. Also, removing 924 recovery points by hand would be quite a tedious job. Automation is the keyword.
Powershell to the rescue!
I had to write a script that would allow me to access the individual recovery points of data that is not part of a protection group (you'll a script easily online from Mike Jacquet, MSFT that'll do exactly that for you), select a range of protection points and in the end, of course, delete them.
First thing to do: get the data sources from the server. $Server contains the host name or FQDN of the DPM server.
First thing to do: get the data sources from the server. $Server contains the host name or FQDN of the DPM server.
C#:
1 | $DataSources = Get-DataSource $Server |
The second step is to get the inactive protected data only, which can be filtered by comparing the individual objects of the $DataSources array to the following:
C#:
1 | $DataSource.InactiveProtectionStatus -EQ [Microsoft.Internal.EnterpriseStorage.Dls.UI.ObjectModel.OMCommon.InactiveProtection]::Disk -OR $DataSource.InactiveProtectionStatus -EQ [Microsoft.Internal.EnterpriseStorage.Dls.UI.ObjectModel.OMCommon.InactiveProtection]::DiskAndTape) |
Now I put away all data sources with inactive protected data into another array called $InactiveServers. For each object in that array I'll have to get the available recovery points. Mind that here I will select the time range through the variable $Retention which I chose to do in days. You can easily alter the code to use months instead. Or hours, or minutes, or... well you, get the point.
C#:
1 | $RecoveryPoints = @(Get-RecoveryPoint $InactiveServer | Where-Object {$_.RepresentedPointInTime.Date -LT $((Get-Date).AddDays(-$Retention))}) |
Great, we have an array with all of our recovery points for a given data source. Now let's delete those RPs. For each object in the array we go:
C#:
1 | Remove-RecoveryPoint -RecoveryPoint $RecoveryPoint -Confirm:$False |
I added the -Confirm:$False because otherwise it will ask you to confirm every single removal. Have fun with a few hundreds of recovery points!
In any case: I made a quick script around this that I happily share with you. It's dirtier than usual - no logging and ugly output to screen (although it is Yellow
) - but I did put quite some safety measures into it so that you don't accidentally remove too much.
The script expects 2 parameters: the server to run on and the retention you want to keep (in days, feel free to change). There is also a third -WhatIf parameter so you can simulate what would happen. Always a good idea!
Finally it will give you an overview of your choices and ask confirmation in a case sensitive way. If you type 'Yes' there, the show really starts
In any case: I made a quick script around this that I happily share with you. It's dirtier than usual - no logging and ugly output to screen (although it is Yellow
The script expects 2 parameters: the server to run on and the retention you want to keep (in days, feel free to change). There is also a third -WhatIf parameter so you can simulate what would happen. Always a good idea!
Finally it will give you an overview of your choices and ask confirmation in a case sensitive way. If you type 'Yes' there, the show really starts
C#:
1 | #Requires -version 2
|
An output example:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| WARNING: You will delete all recovery points from previously protected WARNING: servers on MYDPMSERVER001 that are older than 64 days. WARNING: No recovery points from existing Protection Groups will be deleted. WARNING: Type "Yes" (case sensitive) if you are sure you want to continue. Yes WARNING: Enumerating Datasources WARNING: Sorting inactive servers WARNING: Removing G:\ dated 11/19/2012 20:34:16 from SERVER001.contoso.com WARNING: Removing E:\ dated 11/19/2012 21:59:54 from SERVER001.contoso.com WARNING: Removing G:\ dated 11/19/2012 20:34:16 from SERVER002.contoso.com WARNING: Removing E:\ dated 11/19/2012 21:59:38 from SERVER002.contoso.com WARNING: Removing G:\ dated 11/19/2012 22:00:42 from SERVER003.contoso.com WARNING: Removing E:\ dated 11/19/2012 20:34:17 from SERVER003.contoso.com WARNING: Removing E:\ dated 11/19/2012 22:02:24 from SERVER004.contoso.com WARNING: Removing G:\ dated 11/19/2012 21:04:15 from SERVER004.contoso.com |
That's it. If anyone would be wondering about the Disconnect-DPM-Server both in the beginning and at the end: this is to catch the situation were the script was started (so a DPM connection was made) but prematurely ended (e.g. because of Ctrl+C). This would keep the connection with the DPM server open and running the script subsequently on a different server would fail because there is still an open connection.
I hope someone can use this. Enjoy!
I hope someone can use this. Enjoy!
24-03 PES 2013: "Unable to access hard disk"
01-01 Oost-West: Kerst in Duitsland
Comments
Er is geen enkel topic is waar ik zo weinig reactie op krijg als op DPM
Misschien eens een thread starten op GoT zodat ik een idee heb wie er eigenlijk mee bezig is...
* YellowOnline heeft weet van één Tweaker behalve hemzelf in ieder geval
* YellowOnline heeft weet van één Tweaker behalve hemzelf in ieder geval
[Comment edited on Thursday 24 January 2013 09:29]
Omdat alleen een reactie van jezelf op je blogitem niet zo leuk is geef ik wel een reactie.
Bij deze!
Bij deze!
DPM en ik danken jeMoby wrote on Thursday 24 January 2013 @ 16:00:
Omdat alleen een reactie van jezelf op je blogitem niet zo leuk is geef ik wel een reactie.
Bij deze!
We kunnen er ook gewoon een prive babbelbox van maken, maar dat is wel een beetje respectloos voor je blog natuurlijk.
Hier ook een (Belgische) DPM-gebruiker/operations-dude die ze moet beheren voor verscheidene klanten.YellowOnline wrote on Thursday 24 January 2013 @ 09:28:
Er is geen enkel topic is waar ik zo weinig reactie op krijg als op DPMMisschien eens een thread starten op GoT zodat ik een idee heb wie er eigenlijk mee bezig is...
* YellowOnline heeft weet van één Tweaker behalve hemzelf in ieder geval
Zijn we al met drie \o/
In order to comment on this post you need to be logged in. Use this link to log in when you are already a registered user. If you don't have an account you can create one here.