Extending a VMware vDisk when Provisioned Size is Disabled

Posted by on Sep 11, 2013 in Tech Tip | 0 comments

Print Friendly

You need to extend a VMware vDisk even though the Provisioned Size is set to Disabled.

Share The Love!
Get new article alerts!

Solution

One of the more common needs is to add space to a disk to keep up with increased storage needs of new software and updates to existing software.  Most of time, this is pretty easy but sometimes you might have trouble:

Notice how the Provisioned Size field is disabled? VMware won't let you resize that vDisk, and it's not always obvious why.  Here's a few common reasons and how to get around them.

Keep in mind any of this may corrupt or delete your VMwar vDisk. Have a good backup ready to go!

  1. The guest has one or more snapshots.
    1. Right-click on the guest in the vSphere inventory and expand Snapshot  in the context menu. If the Revert to Current Snapshot  is available, the machine has at least one snapshot.
    2. Open the Snapshot Manager and delete all the snapshots for the guest before you can continue. (Assuming this is something you WANT to do.)NOTE: If you can wait until a scheduled maintenance window for that guest, you can speed up the snapshot deletion significantly by powering off the guest first. If not, you can safely delete snapshots while the guest is running but be aware that it will affect performance.

  2. The virtual disk is using an emulated IDE bus instead of SCSI.
    1. This is one is a little harder to fix but pretty easy to determine.  Edit the guests settings just as if you were going to extend the disk.  The Provisioned Size field will be disabled as above but look immediately below it, in the "Virtual Device Node" section, and you'll see which device that disk is on the emulated bus.  If the text in the box begins with "IDE", that disk is on an IDE bus and cannot be extended as is.  And don't be fooled by the screenshot below;  the input only lets you select which device (master or slave) on which bus (0 or 1) the disk should appear as.  You cannot change the bus type through the vSphere client.
    2. Before you do anything else, make sure you have a good backup of that guest. If the machine is mission critical, it might be worth while to clone that guest so that you have a another copy you can power on quickly if something goes awry during the process described below. You can always delete the clone later after you've verified the original copy is fully functional.
    3. You'll need to enable SSH access to your ESXi server. You'll also need to know where the files for the target guest are located. Immediately above the "Disk Provisioning" section of the guest's settings is the path to the disk you're trying to extend:
    4. In this case, it's on the "datastore-lab" datastore in a folder named "Test vm". Power off the guest, connect to a root (or similar administrative user) shell on the ESXi host using your preferred SSH client , and change directory to folder where the guest's files are stored:
      ~ # cd /vmfs/volumes/datastore-lab/Test\ vm/
    5. A file listing should like similar to the following
      /vmfs/volumes/50f9c1b9-dc41cb6e-f851-00188b50a708/Test vm # ls -lAhrt
      -rw------- 1 root root 8.0G Sep 11 03:08 Test vm-flat.vmdk
      -rw------- 1 root root 262 Sep 11 03:35 Test vm.vmxf
      -rwx------ 1 root root 1.5k Sep 11 03:52 Test vm.vmx
      -rw-r--r-- 1 root root 43 Sep 11 03:52 Test vm.vmsd
      -rw------- 1 root root 463 Sep 11 03:52 Test vm.vmdk
      /vmfs/volumes/50f9c1b9-dc41cb6e-f851-00188b50a708/Test vm #
    6. You'll see 2 files with the .vmdk extension:[guest name].vmdk
      This is a text file which defines metadata about the disk that tells ESXi how to provide it to the guest. This should only be a few hundred bytes in size.

      [guest name]-flat.vmdk
      DO NOT TOUCH THIS FILE!!! This is the actual data that comprises the guests' disk and will be either the same size as the guest's disk (for thick provisioned disks) or the same as the used space on the guest's disk (for thin provisioned disks).  Altering this file in anyway will almost certainly destroy the disk and you'll have to restore from backup.
    7. Edit the former VMDK file in vi and look for a line like:
      ddb.adapterType = "ide"
    8. Change the value from "ide" to "lsilogic" and save the file.
    9. Return to the guest settings in the vSphere client.  Select the IDE disk and click Delete; make sure you select just "Remove from virtual machine", not "Remove from virtual machine and delete files from disk".
    10. Click the Add button  and add the same disk back to the guest. Note that in the "Advanced Options" step, you're now asked which SCSI LUN ID the disk should have, instead of the IDE bus and position.


    11. Click OK to save the changes.  Power on the machine to confirm the change in the bus type didn't have any unintended side effects (i.e failure to boot, etc.)

You should now be able to edit the guest's settings and extend the disk like normal.


Tags:



Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>