Howto: Expand VM boot partition

One of my virtual machines, running on ESX Server 3 (VI3) was in dire need to get it's boot partition expanded. Obviously I had miscalculated the storage requirements for this particular VM, but luckily there is an easy way to expand the VMDK file and then use third party tools to let Windows utilize the new space.
  • 1. Shut down the Virtual Machine
  • 2. Expanding the VMDK
    Log into the ESX server via ssh (I prefer Putty) Find the .vmdk file you want to expand and use vmkfstools to expand it:
    vmkfstools -X 20g vmname.vmdk That expands the existing virtual disk to 20 Gigabytes, now we need to make the extra space available to Windows.
  • 3. Resize boot partition
    As Windows doesn't allow you to resize the active boot partition, you'll need a third party tool to accomplish this step. GParted Screenshot In this case I used the GParted LiveCD, but you could also use BartPE or other bootable disk partition/resize tools.
    All I did was to download the GParted ISO, copy the .ISO to my datastore, mount it as a Virtual CD-ROM device and boot my VM from it. Then use the tool of choice to expand the existing partition.
  • 4. Remove the virtual CD-ROM device and reboot the VM
Thats it. How painful would that have been if this was a physical machine?

Posted by Christian Mohn aka h0bbel

Post metadata


Published April 10, 2007 10:07
24 comments

Tagged with , , , , , , , , , and 


24 Responses to Howto: Expand VM boot partition:

  • Planet V12n
    April 10, 2007 12:22pm

    […] Howto: Expand VM boot partition […]

  • Brad Baughn
    April 10, 2007 3:09pm

    I would also recommend the article below from vmprofessionals. It does not require any 3rd party tools, and works on both boot and non-boot partitions. It basically takes advantage of diskpart that is built into W2K3.

    http://vmprofessional.com/index.php?content=2k3resize

  • h0bbel
    April 10, 2007 3:25pm

    Sure, but this requires using a second VM to and mounting the partition you need to extend. See “Step 4: For this step you will need an additional Virtual Machine running Windows Server 2003”.

    The method outlined above doesn’t need a second VM, and you can do the partition extension inside a nice friendly GUI-based application like GParted.

  • J.Cruz
    April 10, 2007 3:55pm

    Another option would be to use the VMWare Converter to “convert” one VM to another with a larger boot partition. We’ve had good success with that over here.

  • h0bbel
    April 10, 2007 4:41pm

    Ah, good idea. I never thought of that!

  • Mike
    April 10, 2007 5:50pm

    Thanks for the tech tip, I just have to comment on the part about “How painful would that have been if this was a physical machine?”… Um, exact same effort on a physical machine, really. Partition Magic, Acronis, or any number of other partition editors will let you easily resize partitions if you have free disk space - been there, done it. :)

  • crouton
    April 10, 2007 6:01pm

    One tip when resizing Windows VMs - you must shutdown the VM cleanly, or the GParted process will fail to resize correctly. You’ll end up with a correctly resized partition, but Windows won’t be able to see or use that extra space.

  • h0bbel
    April 10, 2007 7:53pm

    @Mike: Sure, if you have the free space, the effort would be the same.

    @crouton: Of course, a clean shutdown would be essential.

  • VMTN Blog
    April 14, 2007 3:58pm

    […] a disk in a virtual machine is not hard, but usually takes two steps: h0bbel on a boot partition, Gagazote, […]

  • News und Stories » Howto: Expand VM boot partition
    April 14, 2007 4:53pm

    […] Howto: Expand VM boot partition One of my virtual machines, running on ESX Server 3 (VI3) was in dire need to get it’s … […]

  • random bits of useful knowledge
    April 16, 2007 9:57pm

    resizing of a disk

  • StumbleUpon » Your page is now on StumbleUpon!
    April 17, 2007 3:31am

    […] Your page is on StumbleUpon […]

  • Virtualized Automaton
    April 24, 2007 1:10pm

    Defragging virtual disks - http://www.vmware.com/community/thread.jspa?threadID=77661&tstart=0 Resizing Windows VM disks - http://www.vmprofessional.com/index.php?content=2k3resize Resizing Windows VM disks - http://h0bbel.p0ggel.org/2007/04/10/howto-expand-vm-boot-partition/ Resizing Windows VM disks - http://linux.softpedia.com/get/System/Recovery/System-Rescue-CD-188.shtml Unable to log on if the boot partition drive letter has changed - http://support.microsoft.com/kb/249321/en-us

  • Be virtual, My friend
    May 3, 2007 6:34pm

    Defragging virtual disks - http://www.vmware.com/community/thread.jspa?threadID=77661&tstart=0 Resizing Windows VM disks - http://www.vmprofessional.com/index.php?content=2k3resize Resizing Windows VM disks - http://h0bbel.p0ggel.org/2007/04/10/howto-expand-vm-boot-partition/ Resizing Windows VM disks - http://linux.softpedia.com/get/System/Recovery/System-Rescue-CD-188.shtml Unable to log on if the boot partition drive letter has changed - http://support.microsoft.com/kb/249321/en-us

  • Kurrin
    May 3, 2007 9:02pm

    Defragging virtual disks - http://www.vmware.com/community/thread.jspa?threadID=77661&tstart=0 Resizing Windows VM disks - http://www.vmprofessional.com/index.php?content=2k3resize Resizing Windows VM disks - http://h0bbel.p0ggel.org/2007/04/10/howto-expand-vm-boot-partition/ Resizing Windows VM disks - http://linux.softpedia.com/get/System/Recovery/System-Rescue-CD-188.shtml Unable to log on if the boot partition drive letter has changed - http://support.microsoft.com/kb/249321/en-us

  • vmware
    May 5, 2007 1:11pm

    […] VM disks - http://www.vmprofessional.com/index.php?content=2k3resize Resizing Windows VM disks - http://h0bbel.p0ggel.org/2007/04 … -vm-boot-partition/ Resizing Windows VM disks - http://linux.softpedia.com/get/S … Rescue-CD-188.shtml Unable to log […]

  • News und Stories » Booahh ist der dick Mann
    May 19, 2007 4:34pm

    […] Howto: Expand VM boot partition One of my virtual machines, running on ESX Server 3 (VI3) was in dire need to get it’s … […]

  • VMTN Discussion Forums: Lots of Vmware Links.... ...
    June 1, 2007 10:50am

    […] […]

  • VMware Links
    June 15, 2007 2:20pm

    […] […]

  • Virtual Disk (VMDK)
    August 14, 2007 3:52pm

    […] of Windows 2003 VM Resizing Windows VM disks Defragging virtual disks Resizing Windows VM disks Resizing Windows VM disks Resizing Windows VM disks Unable to log on if the boot partition drive letter has changed How to […]

  • silicon massiah
    November 4, 2007 9:17pm

    Let’s be rigerous in our distinction.
    We’re expanding the logical drive size of a virtual Windows 2003 server’s primary boot partition. Drives are divided as follows:

    physical hard drive (or virtual)
    partition
    volume
    logical drive

    1. On the host with the vm not running, make a copy of the drive with the primary boot partition and place it in it’s own folder.

    2. Add it to the vm as an additional drive.

    3. Use the vm disk utility to expand the drive size.

    3. Boot the vm, and in a dos window launch the diskpart utility (c:\diskpart). (expand drive #) is the command to expand the drive.

    4. Shut down the vm and delete (have a good backup of the host machine) the primary drive.

    5. Copy the vm drive with the newly expanded logical drive to the location of the deleted original drive.

    6. Boot the vm and thank god for my existnace. Everything is possible with the software you already have. Stop spending money.

    Silicohn Messiah
    aka tom davis

    If you done it, it ain’t braggin.
    - Will Rogers

  • Jonathan Ng
    October 16, 2008 9:46pm

    Just a note of caution (I learned this the hard way). I decided to try this technique after the GUI didn’t allow me to resize my system disk.

    If you use this technique, ensure that you do not have any snapshots present. If you do, and you are resizing your system disk in this fashion, ESX will either error out or will unilaterally return you to your base snapshot.

    Luckily I was working on a lab machine when this happened, so I can rebuild it, but if this were a production machine, I would have been in big trouble.

  • Christian Mohn (h0bbel)
    October 16, 2008 10:36pm

    @Jonathan Ng: That’s a valid point. I’ve never had any snapshots present when I’ve done this, so I’ve never had any problems with it. I don’t usually have snapshots on any of my production servers though.

  • ijaved
    March 19, 2009 12:11pm

    Alright i wana thank you for awesome tutorial. Neat and small. Only thing i wana add is Gparted live cd didnt detect my scsi partition after booting it was just blank.

    So i had Hiren’s Bootable Cd 9.5 which i tried but couldnt load the software cause the virtual cdrom was not supported. After googling i found out that Hirens Bootable CD 9.8 works on esx servers and it did. Tried partition magic and it gave me some log error. No problem restarted and using Acronic Disk Director and it resized the pri hard drive to the unallocated space.

    One thing to add is if your vm is created with spaces in the name then you have to add backspace \ after each word that has space.

    eg :-

    If your vm name is New Virtual Machine_1 then you have do the following command. Took me awhile to figure out.

    vmkfstools -X 10g /vmfs/volumes/DataStore/New\ Virtual\ Machine_1/New\ Virtual\ Machine.vmdk

    Also i couldnt run vmkfstools cause i was only doing (su) and not (su -) from putty. So it couldnt run vmkfstools cause of the $PATH was not copied.

    I hope it helps someone else cause all i wanted was this yesterday. Hopefully this will save someone’s time. Cheers

13 Pingbacks to Howto: Expand VM boot partition:

  • Planet V12n
    April 10, 2007 12:22pm

    […] Howto: Expand VM boot partition […]

  • VMTN Blog
    April 14, 2007 3:58pm

    […] a disk in a virtual machine is not hard, but usually takes two steps: h0bbel on a boot partition, Gagazote, […]

  • News und Stories » Howto: Expand VM boot partition
    April 14, 2007 4:53pm

    […] Howto: Expand VM boot partition One of my virtual machines, running on ESX Server 3 (VI3) was in dire need to get it’s … […]

  • random bits of useful knowledge
    April 16, 2007 9:57pm

    resizing of a disk

  • StumbleUpon » Your page is now on StumbleUpon!
    April 17, 2007 3:31am

    […] Your page is on StumbleUpon […]

  • Virtualized Automaton
    April 24, 2007 1:10pm

    Defragging virtual disks - http://www.vmware.com/community/thread.jspa?threadID=77661&tstart=0 Resizing Windows VM disks - http://www.vmprofessional.com/index.php?content=2k3resize Resizing Windows VM disks - http://h0bbel.p0ggel.org/2007/04/10/howto-expand-vm-boot-partition/ Resizing Windows VM disks - http://linux.softpedia.com/get/System/Recovery/System-Rescue-CD-188.shtml Unable to log on if the boot partition drive letter has changed - http://support.microsoft.com/kb/249321/en-us

  • Be virtual, My friend
    May 3, 2007 6:34pm

    Defragging virtual disks - http://www.vmware.com/community/thread.jspa?threadID=77661&tstart=0 Resizing Windows VM disks - http://www.vmprofessional.com/index.php?content=2k3resize Resizing Windows VM disks - http://h0bbel.p0ggel.org/2007/04/10/howto-expand-vm-boot-partition/ Resizing Windows VM disks - http://linux.softpedia.com/get/System/Recovery/System-Rescue-CD-188.shtml Unable to log on if the boot partition drive letter has changed - http://support.microsoft.com/kb/249321/en-us

  • Kurrin
    May 3, 2007 9:02pm

    Defragging virtual disks - http://www.vmware.com/community/thread.jspa?threadID=77661&tstart=0 Resizing Windows VM disks - http://www.vmprofessional.com/index.php?content=2k3resize Resizing Windows VM disks - http://h0bbel.p0ggel.org/2007/04/10/howto-expand-vm-boot-partition/ Resizing Windows VM disks - http://linux.softpedia.com/get/System/Recovery/System-Rescue-CD-188.shtml Unable to log on if the boot partition drive letter has changed - http://support.microsoft.com/kb/249321/en-us

  • vmware
    May 5, 2007 1:11pm

    […] VM disks - http://www.vmprofessional.com/index.php?content=2k3resize Resizing Windows VM disks - http://h0bbel.p0ggel.org/2007/04 … -vm-boot-partition/ Resizing Windows VM disks - http://linux.softpedia.com/get/S … Rescue-CD-188.shtml Unable to log […]

  • News und Stories » Booahh ist der dick Mann
    May 19, 2007 4:34pm

    […] Howto: Expand VM boot partition One of my virtual machines, running on ESX Server 3 (VI3) was in dire need to get it’s … […]

  • VMTN Discussion Forums: Lots of Vmware Links.... ...
    June 1, 2007 10:50am

    […] […]

  • VMware Links
    June 15, 2007 2:20pm

    […] […]

  • Virtual Disk (VMDK)
    August 14, 2007 3:52pm

    […] of Windows 2003 VM Resizing Windows VM disks Defragging virtual disks Resizing Windows VM disks Resizing Windows VM disks Resizing Windows VM disks Unable to log on if the boot partition drive letter has changed How to […]

Leave a Reply


Contact me

Lets talk!
Get in touch