Thursday, December 10, 2009

Expanding Hard Disk size of VMware image using VMware Server V2.0.1 on Windows XP with guest OS RedHat EL 5

So I decided to write this post after I spent some good time trying to expand my virtual image's hard disk (HD) successfully!

I don't guarantee that this is the right or shortest way to do it but at least for me, this is the way it worked out.

1st: Power off your image and make sure you backup your image before trying this out.

2nd: Remove any snapshot of your image. Make sure you have no files in your image directory looking like disk-000001.vmdk because this means you still have a snapshot not removed. If you leave out any snapshot, expanding your hard disk will not work out correctly.

3rd: Make sure you have enough space on your original hard disk according to the size you want to expand your image's hard disk with.

4th: Open a console on windows and browse to your image's directory.

5th: Use the command: vmware-vdiskmanager -x **GB ***.vmdk example: "C:\Program Files\VMware Server\vmware-vdiskmanager" -x 40GB disk.vmdk

6th: When it prints out Grow: 100% done. open your image and create a logical ext3 partition using the extra space you assigned to your image's hard disk by using any tool like Gparted for example.

7th: Open Menu > System > Administration > Logical Volume Management tool in RedHat. Go to Unitialized Entries and choose your new partition and Initialize Entity. Then go to Unallocated Volumes select the one your initialized and Add to existing Volume Group.

8th: Go to Volume Groups and select the one you want to expand then click on Edit Properties and press on Use remaining then finish with OK.

Congrats!! Now you should see that your hard disk is expanded and to make sure you can use the df -h command in a root terminal.