Can LUNs Be Extended Online Under VMware and Hyper-V?

All to often I see system admin teams taking SQL Server offline in order to expand LUNs either in a virtual or within a physical environment. This is what I like to call "taking an outage for NO reason". There's no reason whatsoever to take any sort of outage when expanding a LUN either in a virtual or physical environment. Lets take a look at the process and see exactly what needs to be done to expand a LUN.

Related: 7 Best Practices for Running SQL Server on Hyper-V and SQL Server Storage in the Virtual World

My Environment

In order to show how this needs to be done, I'll be using an EMC VNX 5500, vSphere 5.0 and two Windows Server 2008 R2 guests which are in an Active/Passive SQL Server 2008 Cluster. This works the same no matter what storage you have, vSphere 3.5 and higher (I can't speak to the really old versions), or Hyper-V and Windows 2003 or higher, at the guest. If we are doing this on a physical box or a virtual machine, the process is exactly the same.

Storage Array Change

On the storage array, we simply expand the LUN. We don't need to tell the host or the guest (or the physical server if this isn't a VM) about this change yet. In fact, we don't need to touch any servers yet.  Below is the dialog box presented by the EMC management software. As you can seem I'm simply expanding LUN 125 from 100 Gigs to 101 Gigs. Depending on your storage array vendor, the version of the software on the array, and how the LUN is configured this dialog may look identical, or totally different.

LUN Dialog
LUN Dialog

Once the LUN has expanded (this may take seconds or hours depending on how large the LUN is, the systems configuration,etc.) we can now expand the LUN on the server.

The Windows Server

Once we log onto the Windows server, we need to tell the server that there's more space to use. The easiest way to do this is via the command line tool diskpart.exe.  It can be done via the Computer Management MMC snapin as well.

Using diskpart.exe, we can first list out the disks using the "list disk" command. We'll see all the disks which are presented to this machine and their current sizes. We then run "rescan" which does a SCSI rescan looking for changes. Running the "list disk" command again shows the change. Notice the size difference on disk 4.

diskpart
diskpart

Now we need to extend the file system so that Windows and SQL Server have access to the additional space.  We do this by selecting the disk that we want to work with using the "sel disk" command (you can use "sel dis" for short as I've done). We then need to select the partition that we want to extend. We can first list the partitions on the disk using the command "list partition" (or "list part" for short). Then select the partition using "select partition" (or "sel part" for short).

Select Partition
Select Partition

Now we can extend the partition using the command "extend" command. When we list of out the partitions again we see that the partition has been extended. 

Extended
Extended

No changes have been made to the Windows Cluster, or the SQL Server when doing this. Because I'm doing this in a Windows Cluster, the Windows Cluster will automatically tell the other machines that the disk has changed, and it'll rescan the SCSI bus when the cluster fails over. There's no need to go to the secondary machine and make any changes to it.

In Windows 2008 and above, this could have been done by simply doing a SCSI rescan in Computer Management then selecting the partition to be extended, right clicking on the partition and selecting extend.

Ready more from Denny Cherry on his blog, "Troubleshooting SQL Server Storage Problems."

Discuss this Blog Entry 2

on Nov 26, 2012
I have to say that I really like the additional software tooling available from my storage vendor. I can use their tooling installed on my SQL Servers to "grow" LUNs inside a volume. I don't even have to ask the Storage Administrator to do it. Of course, there's a balance there, if there is any thin-provisioning going on, the Storage team might not like unplanned LUN growth :)
on Dec 13, 2012
Great write up as always Denny. I might add that sometimes the partition shows extended but the filesystem within the OS will not show the additional storage and the you have to run "extend filesystem" from within diskpart. Randall Neth | Microsoft Certified Master - SQL Server 2008

Please or Register to post comments.

What's Troubleshooting SQL Server Storage Problems?

Practical advice, insight, and help for core SQL Server considerations.

Contributors

Denny Cherry

Denny Cherry is the owner and principal consultant for Denny Cherry & Associates Consulting and has over a decade of experience working with platforms such as Microsoft SQL Server, Hyper-V,...
Blog Archive

Sponsored Introduction Continue on to (or wait seconds) ×