Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.
Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.

Shadow Copy for DEVs (where’s my code!?)

Recently I overwrote an important CS file with an older (bad) copy.  I had no backup copy and I immediately did a face palm.  I could have avoided this with Shadow Copy.

Shadow Copy provides a clean way to view previous versions of the source code files and restore.  Today I added a new drive letter to the VM with Shadow Copy enabled to keep an extra safety net.   Hopefully if I overwrite the file “precious-8-days-of-coding-only-copy-in-the-world.cs” with garbage again then I’ll be able to quickly recover. 

 

1)  Create “code.vhd” from Computer Management

image
image
image

2)  Initialize the disk

image
image

3)  Detach “code.vhd”

image
image

4)  Add new disk to Virtual Machine  (Oracle VirtualBox here)

image

5)  Boot Virtual Machine and create new partition (F:\ here)

image
image

6)  Enable Shadow Copy on the F:\ drive.   I set for every 10 minutes.

image
image
image
image
image

7)  Move “My Documents” to F:\

Detailed instructions can be found here.

 

By moving “My Documents” to the new F:\ drive letter all new Visual Studio and InfoPath projects will be stored here.  Another benefit is I can backup the small “code.vhd” drive more easily than the full VM.  Hopefully this helps someone else avoid a face palm. 

Smile

© Copyright 2016
@ SPJeff

Return to Top ▲Return to Top ▲