Windows 7 VHD Install – part 2

In my previous post I showed how easy it is to install Windows 7 on a VHD disk, plus some of the benefits of doing so. More on that later when we come to backup, disaster recovery and migration. This time I will show you how you can use additional VHD’s for your disk partitions as well.

Attaching additional VHD’s in Windows 7

Your system partition is now on a VHD, but you might as well move your other partitions to VHD’s too. This will make future migrations to newer hardware even simpler. You can create new VHD’s, attach them and assign drive letters in Disk Management. However, Windows 7 does not attach these VHD’s permanently, in other words after the next reboot your new virtual disks appear to be gone! There is a solution though, thanks to the much underrated Task Manager:

– Without the VHD being attached (otherwise detach it in Disk Management first) start Diskpart from a command prompt or the Run command.

– In Diskpart, type list volume. Take note of the highest volume number.

– Exit Diskpart.

– Create a text file and name it something like “AttachD” (no extension needed).

– Edit this file and add the following lines. Of course change the path, VHD name and required drive letter to your own setup. The volume number is one higher than noted above.

select vdisk file="E:\VHD\<name>.vhd"

attach vdisk

select volume 4

assign letter=d

– In Task Manager, create a new task to run at system startup, hidden, with full privileges. The action this task has to perform is diskpart /s “<file>”, where <file> is to be replaced with the path and name of the above created text file.

– You can expand the text file with more VHD’s to your liking.

– Windows will now automatically attach your VHD’s at every boot.

 

Conclusion

Short and simple, that’s it for today. Next time I will get around to showing the magic of backup and recovery with VHD!

Cheers
Marco

Leave a Reply

Your email address will not be published. Required fields are marked *