Posted by: Brien Posey
Blog – Extending a Virtual Hard Drive
By: Brien M. Posey
A few months ago, I made the decision to virtualize the majority of my physical servers. At the time, the migration went very smoothly, and there were no real issues when the process had completed. What I hadn’t planned on though, was a change in the way that I use disk space.
For many years now, I have been a full time, freelance writer. As such, I write a lot of books, articles, and blog posts like this one. Text really doesn’t take up that much disk space. A lot of times my work includes screen captures, but again these do not consume that much space.
When I virtualized my file server, the volume containing my work was 200 GB in size. It was only a little over half way full, so I decided to leave it as it is. What I didn’t realize at the time though, was that I would soon start doing a lot more work with digital video. For example, I recently recorded a screen cast for another TechTarget site that demonstrates Exchange Server’s unified messaging feature. The point is that digital video consumes a lot of space, and I soon found that my 200 GB volume was no longer enough.
Because the volume existed in the form of a virtual hard drive file, it was sitting on a high speed disk array with a bunch of other virtual hard drive files. There was plenty of free space on the array, but I had to expand the .VHD file to use some of it.
The process was actually fairly simple. I shut down the virtual machine that the drive belonged to, and then I used the Edit Virtual Hard Disk Wizard in the Hyper-V Manager to increase the size of the drive from 200 GB to 500 GB. 500 GB isn’t the limit or anything, it was just the size that I wanted to expand the drive to.
I started the process at about 7:00 last night, and it finished sometime between 2:00 AM and 8:00 AM. In any case, the process takes a long time to complete, and the virtual server is not available during this time (unless you disconnect the virtual hard drive from the server), so you will need to plan for that.
It is also important to remember that extending the .VHD file alone is not enough. You still have to expand the volume on the virtual hard drive to fill the newly allocated space. My virtual machine is running Windows Server 2003 R2 X64, so I used the DISKPART command.
To do so, enter the DISKPART command.
Next, enter the LIST VOLUME command
Each volume will have a corresponding volume number. Make note of the number of the volume that you want to extend.
Enter SELECT VOLUME volume number
Now, enter the EXTEND command. If you use the EXTEND command without any parameters, the volume will expand to fill the remainder of the free space on the hard drive (or virtual hard drive in this case). You can however extend the volume to a specific size. There is a good Knowledgebase article on the subject at: http://support.microsoft.com/kb/325590