I found a great way to elevate the use of VHD files on my laptop. It happens from time to time that I have to re-install my computer with a fresh OS. (it happens to the best of us)
Backing up and restoring can be a long process. Therefore I started using VHD file as my primary storage device. Let me explain. I have created a folder on my c: that is called vhd. Inside this folder I have a VHD file. To create a VHD file in Windows 7 you go to the disk management.
Here you specify size and location/name:
After that is done you have a new disk ready to use. The only problem is that when you boot your computer this VHD is no longer mapped. So you have to re-map it every time. So I created a script for this. First you have to create a “diskpart file”, because we are going to send commands into diskpart (that will be used to map the VHD file).
My “diskpart file” looks like this:
select vdisk file=C:vhdMyDataDisk.vhd attach vdisk
And I saved it under C:MountVHD.s
In order for the VHD to map we have to create a CMD file to execute the diskpart commands that we created in the previous file.
My CMD file looks like this:
start /wait diskpart -s "C:MountVHD.s"
And I saved it under c:MountVHD.cmd
So when I need to re-install my computer I simply have to copy my one and only VHD file and everything is taken care of.
Hope you like this tip.