Sunday, April 11, 2010

Xen Server :: How to Create Local ISO Repository

To create a local ISO Repository for XenServer you can use any directory on the filesystem. The Problem is that the Operating System has normally about 2GB free space left which is too less.

To use the "Local Storage" LVM space you can do it in the following way:
Create LVM Space for ISO Repository

First create a LVM, in this example I use 50GB for ISO space:

# lvcreate -L 50G -n ISO VG_XenStorage-4f9efb1c-2dde-777b-bebf-1f73e99e104c

Please note that your Volume Group is named differentially. To figure out your VG name do the following:

# pvscan
PV /dev/md2 VG VG_XenStorage-4f9efb1c-2dde-777b-bebf-1f73e99e104c lvm2 [458.11 GB / 298.11 GB free]
Total: 1 [458.11 GB] / in use: 1 [458.11 GB] / in no VG: 0 [0 ]

#mkfs -t ext3 /dev/VG_XenStorage-4f9efb1c-2dde-777b-bebf-1f73e99e104/ISO

Mount ISO Repository

Create Mount Directory:

# mkdir /mnt/iso_import

You can  mount the new lvm from /etc/rc.local

# Mount ISO
vgchange -a y
mount /dev/VG_XenStorage-4f9efb1c-2dde-777b-bebf-1f73e99e104c/ISO /mnt/iso_import/

Warning: Don't put the mount in /etc/fstab , you may face booting problem.

Create the following Softlink:

# rmdir /var/opt/xen/iso_import
# ln -s /mnt/iso_import /var/opt/xen

Use the Repository in XenServer

# xe-mount-iso-sr /mnt/iso_import -o bind

Now you can see your repository here and in the XenCenter GUI:

# xe sr-list

uuid ( RO) : 9eaef423-3f5a-48f7-9494-cf55e125324a
name-label ( RW): Remote ISO Library on: /mnt/iso_import
name-description ( RW):
host ( RO): uvm2
type ( RO): iso
content-type ( RO): iso

No comments:

Post a Comment