How to: Extend / Expand Virtual Disk on ESX Server using GUI or command line

Today, a virtual disk of one of my virtual servers running on VMware Virtual Infrastructure 2.5 / VMware ESX Server 3.5  run out of diskspace. Why? Because 50GB are not enough to store all Patches, Microsoft Windows Server Update Service (WSUS) downloads and provides in the LAN…

Since many people asked me about how to expand or extend a virtual disk on VMware ESX Server, i decided to post quick how to / tutorial here..

First of all, always remember, doing a backup is always a good idea especially before changing a disk layout 😉

The required steps / the turorial is as follows:

To expand / extend a Virtual Disk on ESX Server using the GUI & Diskpart

Please read to the end before starting with the procedure!

  • Shut down the Virtual Machine
  • In the VMware Infrastructure Client, right click the Virtual Machine, choose Settings
  • Select the Disk you want to extend / expand
  • Define New Size
  • NOTE: this won’t work if you have any snapshots!
    VMware_ESX_VirtualMachine_Disk_New_Size

    VMware_ESX_VirtualMachine_Disk_New_Size

  • Now start your Virtual Machine. If you extended / expanded the Boot Parition, i gets bit more complicated since the Volume is in use when the operating system is running. To extend a boot partition, additional steps are required.
    • Take a Windows 7 or Windows 2008 or even a Windows Vista Installation Medium. Boot the Virtual Machine using this media. When the Install Windows Window appears, press Shift-F10. This trick / shortcut opens a CMD. From there proceed with the next step using diskpart to extend the disk / partition
      Shift-F10

      Shift-F10

  • Now use Diskpart to extend the Volume
    Microsoft_Diskpart_Extend_Partition

    Microsoft_Diskpart_Extend_Partition

Finally check your Disk or Partition in Explorer to see if it is expanded.

The graphical part can also be done using SSH. If you want to do it that way:

  • Create an SSH Connection to your VMware ESX Server using Putty or some similiar SSH Client
  • Use vmkfstools
    The syntax to extend / expand a Virtual Disk is:
    vmkfstools -X new_sizevmfs_name:disk_name
    i.e. vmkfstools -X 8192m sanVOL12:ServerDrive_D.vmdk

    The syntax reference for vmkfstools is
    vmkfstools -C –createfs vmfs3
    -b –blocksize #[mMkK]
    -S –setfsname fsName
    -Z –extendfs extension-partition
    deviceName

    -P –queryfs -h –humanreadable
    -T –tovmfs3
    -x –upgradetype [zeroedthick|eagerzeroedthick|thin]
    -u –upgradefinish
    vmfsPath

    OPTIONS FOR VIRTUAL DISKS:

    vmkfstools -c –createvirtualdisk #[gGmMkK]
    -d –diskformat [zeroedthick|
    eagerzeroedthick|
    thick|
    thin]
    -a –adapterType [buslogic|lsilogic]
    -w –writezeros
    -j –inflatedisk
    -U –deletevirtualdisk
    -E –renamevirtualdisk srcDisk
    -i –clonevirtualdisk srcDisk
    -d –diskformat [rdm:|rdmp:|
    raw:|thin|2gbsparse|
    monoflat|monosparse]
    -X –extendvirtualdisk #[gGmMkK]
    -M –migratevirtualdisk
    -r –createrdm /vmfs/devices/disks/…
    -q –queryrdm
    -z –createrdmpassthru /vmfs/devices/disks/…
    -v –verbose #
    -g –geometry
    -J –miscop [setuuid | getuuid]
    vmfsPath

    OPTIONS FOR DEVICES:

    vmkfstools -s –scan adapterName
    -L –lock [reserve|release|lunreset|targetreset|busreset] /vmfs/devicees/disks/…

Feel free to comment..

One thought on “How to: Extend / Expand Virtual Disk on ESX Server using GUI or command line

  1. Pingback: VMware ESX / Virtual Center – Extend Virtual Disk « Esx Server « Vmware « ..:: www.christiano.ch //::..

Leave a Reply

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