UPDATED: XenServer 6 and Resizing iSCSI LUN

XenServer 6 has some nifty new features, and one of them is rumored to be the ability to resize an iSCSI LUN without resorting to trickery.

 

Unfortunately, this is not the case. The good news, however, is that it can be done on the fly without the need to restart any of the VMs on the affected LUN.

 

Once your LUN has been resized, you'll notice that the Storage Repository does not recognize the new space. Rescanning the SR also has no effect.

 

The first thing we need to do is install lsscsi. The first step of this is to edit /etc/yum.repos.d/CentOS-Base.repo and change enabled=0 to enabled=1 on the first repository entry in the list.

 

Once that is complete, we can now install lscsci:

 

yum install lsscsi -y

 

Running lsscsi will list all the scsi devices that you have connected (including iSCSI LUNS.) Take note of the scsi device ID for the LUN that you have resized (in my case it was 3:0:0:3) and then run the following command:

 

echo 1 > /sys/class/scsi_disk/3:0:0:3/device/rescan

(Don't forget to substitude 3:0:0:3 with the actual device ID on your system)

 

Once that is done, the scsi bus will be rescanned and now we can continue to tell the OS that is has been resized.  Run lsscsi again and now take note of the device path for the LUN that you have resized (in my case it was /dev/sdh) and run the following command:

 

pvresize /dev/sdh

(Don't forget to substitute /dev/sdh with the actual device path on your system)

 

Now that it has been resized we just need to let the XenServer know about it. Run the following command to find the UUID of your SR:

 

xe sr-list

On my server it has a UUID of f2836d6b-d4aa-c07c-f3ba-fc49caa05e5e so now run the following command:

 

xe sr-update uuid=f2836d6b-d4aa-c07c-f3ba-fc49caa05e5e

(Don't forget to substitute f2836d6b-d4aa-c07c-f3ba-fc49caa05e5e with the actual UUID on your system)

 

That's it, the operation is complete. Close and re-open XenCenter if you had left it open and now your SR should reflect the new size of your iSCSI LUN.

 

UPDATE: If you have a pool of XenServers, and did this process on the pool master, you may run into this situation when you try to boot a VM off the newly sized LUN:

 

Error: The VDI is not available

 

I went through the pvresize process on the other XenServer hosts in the pool to see if I could then boot the VM there and that did not work. I also followed the standard process of vdi-forget and re-attach to VM (see this Citrix forum post) that many people report will fix the problem.

 

However, the real fix is following the (currently) first hit at google for this issue which is this Citrix KB article. In a nutshell - reboot the XenServer host.

 

This is obviously a pain if you have machines running in production. Hopefully your virtualization plan included having enough overhead to migrate VMs so you can do rolling reboots of your XenServers without having to take down production VMs.

 

UPDATE 2: As a test, I resized the iSCSI LUN again and found that if I ran this procedure on all servers in the farm (I had 7 XenServer Hosts in the farm) prior to trying to make use of this extra space (no imports, no drive expansions, etc) then it worked fine.

 

So the solution is to do this on the Pool Master and reboot all the other servers, or run the procedure on all the servers prior to utilizing the extra space.

 



Back to Article Index

blog comments powered by Disqus