Local ISO Storage for XenServer.

XenServer allows you to create an ISO storage, where you can store your ISO images for faster and easier installation of future VMs. That storage can be created on a NFS or a Samba/CIFS share.

Sometimes it isn’t good enough. There are situations where a storage place on local hard drive might be better option. XenCenter interface doesn’t give you such an option, however. This is how to do it.

First, find out where you can create a store. By default, Xen “/” partition is only 4 GB, so it is not a very good candidate for storing ISOs. Much better would be to use same storage that VHDs are stored in.

There are two types of them, used by Xen 5.6 and Xen 6.0. VHDs may be files, stored in a directory that is effectively a LVM partition that Xen uses as a file storage. Other options is that VHDs will be an individual LVM volumes, one per VHD.

In first case, you can create a directory in LVM partition.

Find it’s location using df or mount :

[root@xenserver-uingsfzl ~]# df -h

Filesystem Size Used Avail Use% Mounted on
/dev/sda2 4.0G 3.0G 845M 78% /
none 380M 0 380M 0% /dev/shm
/opt/xensource/packages/iso/XenCenter.iso
51M 51M 0 100% /var/xen/xc-install
/dev/mapper/XSLocalEXT–7dbf981c–5b8e–978d–04d8–16c7aad054bd-7dbf981c–5b8e–978d–04d8–16c7aad054bd
824G 1.9G 780G 1% /var/run/sr-mount/7dbf981c-5b8e-978d-04d8-16c7aad054bd

Create a directory in there

mkdir /var/run/sr-mount/7dbf981c-5b8e-978d-04d8-16c7aad054bd/ISO_Storage

Second case is when VHDs are LVM partitions :

[root@BS25-249029 /]# lvs

LV VG Attr LSize Origin Snap% Move Log Copy% Convert
MGT VG_XenStorage-4eee96be-f808-b5fd-dcaf-b570b22d941c -wi— 4.00M
VHD-28180b8e-dd00-45ad-ad21-515d41230100 VG_XenStorage-4eee96be-f808-b5fd-dcaf-b570b22d941c -wi-ao 150.30G
VHD-7d9b0837-df86-4252-848f-f909f327b658 VG_XenStorage-4eee96be-f808-b5fd-dcaf-b570b22d941c -wi-ao 99.11G

Then use Volume Group name to create new partition there :

lvcreate -L5G -n ISO_Store VG_XenStorage-4eee96be-f808-b5fd-dcaf-b570b22d941c
mkfs.ext3 /dev/VG_XenStorage-4eee96be-f808-b5fd-dcaf-b570b22d941c/ISO_Store
mkdir /ISO_Store
mount /dev/VG_XenStorage-4eee96be-f808-b5fd-dcaf-b570b22d941c/ISO_Store /ISO_Store

add that to fstab if you need it later :

/dev/VG_XenStorage-4eee96be-f808-b5fd-dcaf-b570b22d941c/ISO_Store /ISO_Store ext3 defaults 0 0

Now, mount the storage for Xen usage :

xe-mount-iso-sr /path/to/your/storage -o bind

You should see new storage in XenCenter now

This entry was posted in Managed Hosting. Bookmark the permalink.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>