[OS] Citrix XenServer 6.0 Free – Lokalna biblioteka obrazów ISO

Poniżej prezentuję ciekawy sposób na stworzenie lokalnej biblioteki obrazów ISO dla naszego serwera Xen:

XenServer create local ISO Repository (LVM)
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:
Check the free space on LVM:
# pvscan
PV /dev/sdd VG VG_XenStorage-01fd5809-9dbe-a178-7d6d-71f52ae325c7 lvm2
[1023.99 GB / 595.20 GB free]
PV /dev/sdc VG VG_XenStorage-e9c6e3d2-eafd-f0ed-2478-5ef4e6669210 lvm2 [499.99
GB / 386.96 GB free]
PV /dev/sdb VG VG_XenStorage-b913729f-a015-42a5-a1e7-da412b527421 lvm2 [372.60
GB / 372.58 GB free]
Total: 3 [1.85 TB] / in use: 3 [1.85 TB] / in no VG: 0 [0 ]

and show actual used storage:

# xe sr-list type=lvm
uuid ( RO) : b913729f-a015-42a5-a1e7-da412b527421
name-label ( RW): Local storage
name-description ( RW):
host ( RO): xen1
type ( RO): lvm
content-type ( RO): user
Create LVM Space for ISO Repository

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

# lvcreate -L 50G -n ISO VVG_XenStorage-01fd5809-9dbe-a178-7d6d-71f52ae325c7

Format the new space:

# mkfs.ext3 /dev/VG_XenStorage-01fd5809-9dbe-a178-7d6d-71f52ae325c7/ISO

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-01fd5809-9dbe-a178-7d6d-71f52ae325c7 lvm2
[458.11 GB / 298.11 GB free]
Total: 1 [458.11 GB] / in use: 1 [458.11 GB] / in no VG: 0 [0 ]

Mount ISO Repository

Create Mount Directory:

# mkdir /mnt/iso_import

We mount the new lvm from /etc/rc.local

# Mount ISO
vgchange -a y
mount /dev/VG_XenStorage-01fd5809-9dbe-a178-7d6d-71f52ae325c7/ISO

Warning Warning: Don't put the mount in /etc/fstab. There was a problem with booting
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