Friday, 23 September 2016

Clear Old Backups Windows Server 2012 R2




There are a number of people asking how to clean up Server 2012 backups and not many answers except to say Windows does it automatically.  There is a way!

Using Diskshadow at the command prompt you can wipe away all the old backups.

Open Server Manager > File and Storage Services > Volumes
For instance this is my backup location. \\?\Volume{9f7925e7-0a88-47a6-a6da-357dd7229cb1}.  








Now launch an Elevated Command Prompt and type "Diskshadow" without the quotes.

Then type "List Shadows all" and you should see the volume identifier many times over.
In my case I had 60 shadow copies listed with that volume.  

Run this command using your volume information in my case for example: 
Delete Shadows Volume \\?\Volume{9f7925e7-0a88-47a6-a6da-357dd7229cb1}

This removed all but the latest backup.  I tested by restoring both a new and old file to my server and running a manual backup all worked perfectly.  Be aware the first backup will take some time to complete while it rebuilds the backup set however it wont consume anymore space than a normal scheduled backup.

I'm sure someone much smarter than me could write an app that would be able to go through the shadows and show the backups by date/time and give you the option of deleting certain backups.

I hope this helps out and as usual be careful with your data.  Make backups and use this tutorial at your own risk.

Feel free to comment.

No comments:

Post a Comment