///How to resize your SR in Xen

How to resize your SR in Xen

Want create site? Find Free WordPress Themes and plugins.

Since a while, i’m using OpenFiler 2.x and Xen 4.01 Enterprise.
I use the iSCSI capabilities of OpenFiler for my Storage Repositories (SR) in Xen.

Last week i had a space problem for one of my VMs in XEN: The (virtual) Harddrive was only 30GB and i wanted to add another drive of 60GB. However, my Storage Repository (SR) was only 30GB!

I logged in to my OpenFiler machine with Putty and resized the iSCSI Volume with “lvextend -L +60G /dev/<MyGroup>/<MyiSCSIVolume>“.

In Xen i still saw that the Storage Repository was only 30GB, after restarting the OpenFiler iSCSI Target Service (using the GUI) and rebooting the XEN Server, the SR was still 30GB.

I logged in to the Xen Console (using Putty, but you can also use the XenCenter) and did a “xe sr-scan <my-sr-uuid>” and it was still 30GB, even after removing the SR and re-adding it.

After one night reading forums and Google’ing around I found the pvresize command, i red a lot of threads were people say it doesn’t work, well, it does work but you need to do the following:

xe sr-list name-label=<your SR name you want to resize>
Note the uuid of the SR.

pvscan | grep “<the uuid you noted in the previous step>
Note the device name (eg: PV /dev/sdj )

pvresize <device name>  (eg: pvresize /dev/sdj )

xe sr-scan <the uuid you noted in the previous step>

Now you see (check it using the XenCenter ;) ) that the SR is resized ! You can do the above while the VM is running in VM.
Most problems occur when people do “pvresize /dev/sda” (like most examples are), but when you have several (iSCSI) Storage Repositories, it could be /dev/sdc of /dev/sdj or whatever.

I’d add my new (virtual) Harddive and i had plenty of space again!

Did you find apk for android? You can find new Free Android Games and apps.
By |2010-10-29T02:17:09+00:00November 3rd, 2007|Technical|6 Comments


  1. Konrad Ruess 7 May 2012 at 10:39

    Still valid and working for XS 5.6sp2.

    If you have more than 1 XS sharing the storage, you have to issue the ‘iscsiadm -m node -R’ command on each server, otherwise you will get read errors related to non-existing devices thrown during pvscan command.

    BfN, Konrad

  2. bofh42 30 June 2009 at 16:44

    copy & past template for the job, jut set your SR name

    # resize the lun on the iscsi server

    # replace in the next line
    SR2GROW=`xe sr-list params=uuid name-label= | awk ‘{ print $NF }’`

    # find devices to resize
    DEV2GROW=`pvscan | grep $SR2GROW | awk ‘{ print $2 }’`

    # scan for resized devices
    iscsiadm -m node -R

    # do the resize
    for dev in $DEV2GROW ; do
    pvresize $dev

    # tell xenapi to look for the new LVM size
    xe sr-scan uuid=${SR2GROW}

  3. Bart 25 June 2009 at 12:39

    For resizing without reboot, first run the command:
    iscsiadm -m node -R

    This will rescan the iSCSI devices and detect the new sizes.

    After this, you continue with pvresize & sr-scan.

  4. JTY 26 April 2008 at 04:37

    I had to reboot my Xen server before running pvresize. Otherwise, it didn’t recognize the increased disk space. Likely because Open-iSCSI needs to reconnect to see the larger LUN.

  5. Carlos Taborda 11 April 2008 at 22:52

    for some reason, it didnt do anything for me (ctaborda at lansyx.com) Let me know if you could give me some help.

    I had a 250gb LUN, and expanded it to 750GB, I am now trying to expand my SR as well.

    I did the following :

    # xe sr-list name-label=XenContainer
    uuid ( RO) : c12f813c-8e4c-b04f-4872-0930c8b84f51
    name-label ( RW): XenContainer
    name-description ( RW):
    type ( RO): lvm
    content-type ( RO): user

    # pvscan | grep c12f813c-8e4c-b04f-4872-0930c8b84f51
    PV /dev/dm-3 VG VG_XenStorage-c12f813c-8e4c-b04f-4872-0930c8b84f51 lvm2 [249.99 GB / 79.99 GB free]

    # pvresize /dev/dm-3
    Physical volume “/dev/dm-3” changed
    1 physical volume(s) resized / 0 physical volume(s) not resized

    # xe sr-scan uuid=c12f813c-8e4c-b04f-4872-0930c8b84f51

    After this, I check within XenCenter and I still see my SR as 250g! I would love some help. Also, am I safe from loosing data by doingthis?


  6. Ben Norman 11 January 2008 at 07:21

    Hi Roel, Thanks for the help. I used the same commands for a shared Fibre Channel San Storage. Worked a treat. Just a quick note for anyone using the xe sr-scan command to make sure you add the uuid at the end as below.

    xe sr-scan uuid=


Leave A Comment

The store is not open, I am testing it and maybe it will open in future. If you need any of the products (which I found handy and using), contact me. Dismiss