First off, many thanks to Gethyn for the opportunity to post on his excellent blog.

I’m Christian Dadswell and I am a Senior Infrastructure Analyst at the Intellectual Property Office. I have 15+ years cross platform IT experience and currently support and maintain, amongst other things, the vSphere infrastructure from SAN (fabric and storage) thru vSphere to the virtual machines.

In this article it is my intention to give you some options for resizing a VMFS LUN to allow you to increase the size of a Windows VM volume. It will also cover a scenario whereby a VM has been frozen in operation due to lack of disk space.

Previous experience has shown me that VM’s occasionally require more space for whatever reason. This happens more often than not with SQL Server VM’s. Sorry, but you SQL DBA types love to eat SAN space. But seriously if a VM needs more space for its OS or data volumes something will need to be done.

To kick things off I will create a couple of scenarios that you may well of come across in your day to day vSphere admin. I will then discuss how to remedy them.

The scenarios assume you are using vSphere 4.x and above with an IBM SVC. Other storage virtualisation vendors should allow vdisk resizing. More on vdisk resizing later.

Scenario One:

A Windows 2008 SQL VM (SQL01) has been designated it’s very own VMFS LUN within vSphere, for arguments sake, this VMFS LUN contains all volumes that the VM will use.

VMFS LUN size = 1TB

VM volumes and sizes:

C: OS - 40GB

E: SQLDATA - 450GB

F: SQLBAK - 500GB

Total = 990GB

The DBA requires more OS space and the vSphere admin notes that an extra 20% of space should be available to allow for snapshots. Unfortunately, when the VM was created nearly all the available space was used up.

The SQL01 OS volume needs resizing as its critically low on disk space. As this is a Windows 2008 VM it is very easy to resize the boot volume without even rebooting the VM. But the problem exists that no extra space exists on the VMFS LUN.

Scenario One Options:

As the VMFS LUN has no extra space there are two options;

1. Extent the VMFS LUN from within vSphere with space from another LUN

2. Resize the underlying VDISK presented to vSphere from within the SVC console and then resize the VMFS LUN into the new space.

Option one will not be covered in this article, but is a very straight forward task. Option two is a little more interesting and I will now cover how to achieve this task.

For the sake of this article we will need to assume that there is available space on the underlying VDISK that has been presented to vSphere. See this Wiki for the full skinny on VDISKS (http://en.wikipedia.org/wiki/Vdisk)

Scenario One Tasks:

? Resize the underlying VDISK via the SVC console

? Resize the VMFS LUN within vSphere

? Adjust the SQL01 VM Boot Volume to 60GB

? Resize SQL01’s OS volume

Resize the underlying VDISK via the SVC console

1. Log into the SVC console and select “Work with Virtual Disks”

2. Locate the VDISK you wish to re-size in the table and select it

3. From the drop down at the top of the table, select “Resize Virtual Disk”

4. Follow the wizard and enter the extra size that is required, in this example we’ll add 500GB.

5. Finish the wizard and log out of the SVC console

Resize the VMFS LUN within vSphere

1. Log into the vSphere client

2. Select a vSphere host and go to the Configuration tab and select Storage Adaptors

3. Select Rescan All

a. This will pick up the extra space given to the VMFS volume we just re-sized in the previous step

4. Once the rescan has completed (check the status in the bottom of the client) locate the VMFS LUN, right-click and select Properties

5. You should now see the new VMFS LUN size of 1.5TB

6. Click Next and you should now see that there is free space available (under the Capacity label)

7. Select Next and tick the Maximize capacity tick box

8. Confirm you want to resize by selecting Finish

9. The VMFS LUN is now 1.5TB

Adjust the SQL01 VM Boot Volume to 60GB

NOTE: Ensure you have a backup before running any volume resizes.

1. Shut SQL01 down

2. Right-click the VM within the vSphere client and select Edit Settings

3. Select the hard disk that is designated as the boot drive

a. This should be the 40GB volume

4. Modify this to 60GB and OK the dialog

5. Power on SQL01

Resize SQL01’s OS volume

1. Log into the SQL01 VM as an Administrator

2. Open Computer Management and select Disk Management under Storage

3. Right-click the OS volume and select Extend Volume

4. Extend the volume by 20GB

At this point we have achieved what we set out to do. But what if the VM was Windows 2003 Server?

Resizing a Windows 2003 OS volume

NOTE: Ensure you have a backup before running any volume resizes.

In order to resize an OS volume in Windows 2003 you will need a third party tool and downtime on the VM. One that I use more often than not is GParted Live (http://gparted.sourceforge.net/livecd.php). It comes in ISO/USB/PXD and HD formats. ISO format is perfect for attaching to VM CDs so just chuck a copy in your ISO store.

Tip:

Something that I have found that is worth doing before running GParted on the OS volume is to do a ‘CHKDSK /f C:’ from the command prompt of the Windows server. This willrequire a reboot* to do a check on next boot up and fix any errors.

*The reboot is required due to the requirement of locking the file system.

Back to the resize...

1. Take the VM down and attach the GParted ISO to the VM’s CD drive and ensure that “Power on boot” and “Connected” are ticked before pressing OK.

2. Power on the VM and click inside the console window as soon as you can and press ESC. You need to get into the boot menu and select CD.

3. Once inside the GParted interface select the boot volume and re-size into the extra space as required.

4. Apply the changes, and let it do its thing

5. Once completed, power off the VM, disconnect the ISO and power it back up

You have now re-sized the boot partition on a Windows 2003 Server.

Scenario Two:

This next scenario is very similar to the above, but the VM has been frozen by vSphere as the VMFS LUN has completely run out of space.

In this situation vSphere will freeze the VM at the point that disk space ran out and you will not be able to do any of the following;

? vMotion

? Storage vMotion

? Snapshot

? Edit machine settings

? Power off

? Power on

On the main screen for the VM within the vSphere client you will notice a yellow box is now advising you that you need to free up space to be able to run the VM again. Do not make a decision on this box yet.

This machine is now effectively offline so we need to free space up on the VMFS LUN in order for vSphere to be able to commence running the machine again.

Fortunately, we can just run through the two steps in the previous scenario in order to get this VM up and running again. Namely;

? Resize the underlying VDISK via the SVC console

? Resize the VMFS LUN within vSphere

Once you have performed these tasks you will be able to select ‘Retry’ on the yellow dialog on the VM’s general screen. The VM will now continue to run exactly where it left off!

Unfortunately, it won’t deal with the carnage that ensues after the service has been restored.

I hope you enjoyed this guest article. If you wish to get in touch, you may do so in the following ways;