Tag Archives: vhd

Keeping a VHD Mounted in Windows, Even After A Reboot

While Windows 7 comes with native support for mount VHD files there is one downside , all VHDs are unmount it every the system goes through a reboot. The shortcoming can be remedied with the help of a free third party tool called VHD Attach created by Josip Medved.

You can download VHD attach from the following page http://www.jmedved.com/vhdattach/

This is a two step tutorial. First we’ll have to specify the VHD we need to be auto mounted , second the VHD will be mounted with a drive letter.

Note: This post assumes you already installed the application.

Auto Mount

Start the application and click on the highlighted icon found at the top of the right corner.

VHD Attach

Now click on the Add button.

VHD Attach

Browse to the directory where the VHD you wish to mount is located and double click on the VHD to selected.

VHD Attach

Click on the OK button to save the changes.

VHD Attach

Mount the VHD

Now that you are back in the main menu click on the Open icon.

VHD Attach

Once again browse to the location where VHD is found and double click on it.

VHD Attach

VHD Attach will display relevant information about the VHD. Click on the Attach button found at the top. After this step the VHD becomes accessible from My Computer.

VHD Attach

If you click on the Tools button you can see that the VHD will be mounted on every start up, you can even change the drive letter if you like. You can close the window if you like, from now on the VHD will be automatically mounted every time Windows starts.

VHD Attach

And here is the VHD displayed as a local drive.

VHD Attach

Comments and questions are always welcomed.

Links

VHD Attach Home page jmedved.com/vhdattach/

Windows: How To Compact A Dynamic VHD

Making use of dynaminc VHDs or Virtual Hard Disks has the benefit of growing along with the users need. The downside is that even after files are deleted from a dynamic VHD it will remain the same size as if the files where never deleted.

This becomes a problem if you make use of multiple VHDs because you are essentially wasting space on files that no longer exist. The solution is to Compact the VHD using Diskpart a tool provided with Windows.

Start Compacting

Open a command line window and type:

diskpart

Select the disk you wish to compact by specifying the drive where the file is located and the path:

select vdisk file="F:DAT100GB.vhd"

Attach the disk as Read-only:

attach vdisk readonly

And issue the command to compact:

compact vdisk

Depending on the size of the drive the operation may take some.

Detach the VHD:

detach vdisk

In my case after compacting a 100GB VHD with 20GB of deleted data the size decreased to 82.2MB, Dynamic VHDs are useful but can also become the reason why disk space is low. If you have any questions leave a comment below.