How to change a XenServer’s local storage repository from LVM to EXT

By default, XenServer create LVM-type local storage repository (SR). The LVM-type local SR does not support VHD-formatted virtual hard disks, and hence may not be an ideal option when you are using XenServer along with OpenStack which requires access to individual VHD files for VM snapshot and migration. With EXT-type local SR, you can get direct access to VHD files.

If you want to change local storage repository from LVM to EXT, you can follow the steps below.

First, find out the partition for XenServer's local SR from /etc/xensource-inventory.

$ cat /etc/xensource-inventory
. . . .
DEFAULT_SR_PHYSDEVS='dev/sda3'
. . . .

Like above, the default XenServer installation with a single hard disk creates local SR in /dev/sda3. Make the note of this information as it's needed when you create an EXT-type SR.

Now go ahead and remove the existing LVM-type local SR as follows.

Find out the UUID of the existing local SR:

$ xe sr-list name-label="Local storage" type=lvm

Find out the UUID of physical block device associated with the local SR:

$ xe pbd-list sr-uuid=[local_storage_uuid]

Remove the physical block device and purge the local SR:

$ xe pbd-unplug uuid=[pbd_uuid]
$ xe pbd-destroy uuid=[pbd_uuid]
$ xe sr-forget uuid=[local_storage_uuid]

Finally, create a new EXT-type local SR as follows.

$ xe sr-create content-type="Local SR" host-uuid=(press tab to enter it automatically) type=ext device-config-device=/dev/sda3 shared=false name-label="Local File SR"

In the above command, replace "/dev/sda3" with the information you find out from /dev/xensource-inventory. This command will take a few minutes to run, depending on the size of the partition. If successfully completed, it will print out the UUID of the new EXT-type local SR created.

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

Leave a comment

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

Current day month ye@r *