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.

Tuesday 7 May 2013

Windows Server 2012 Where Did My Disk Space Go?



I am going to provide a few pointers on Windows Server 2012 and loss of disk space.  There is not a lot of info out there so I will try and pool it into one place.  I myself lost a large chunk of space. 

Running:

"Optimize-Volume d -ReTrim -SlabConsolidate -Verbose"

command from power shell did not help although this is a good start to reclaim space.

The problem started when I created a backup image on my Storage Space drive then manually deleted it.  The space was not released even though the file was gone.  I decided to check out Diskshadow.

To do this run Command Prompt Elevated or As Administrator.
 
At the command prompt type "Diskshadow" without the quotes.























Then type "List Shadows all" and you should see:
























Next look for your drive spaces volume in the list.  If its not in the list there are no shadow copies and
this is not the problem.  For example here you can see E: drive listed above has 1 Shadow Copy. 
To delete all Shadow Copies on this volume type  "Delete Shadows Volume E:" . 
(NB: This is an old Shadow Copy from Windows Home Server 2011 but the process is no different.)

If successful you should see:

























Once this is done you will need to run "Optimize-Volume e -ReTrim -SlabConsolidate -Verbose". The volume letter in this case is "e" but you can change that to match the drive of your Spaces disk.

Below is the result of running the Power Shell Command:






















 
 
 
 
 
 
 


















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.