How to create a local ISO Storage Repository on Citrix XenServer


citrix-logoIn order to create virtual machines based on ISO disks, you need a local ISO Storage Repository on Citrix XenServer. There are several options of ISO Storage repositories in Xen Server based on the location of the repository. You should check the location based on the available space and your space requirements. We recommend to pass:

df -h

before choosing the location. Please be aware that sometimes LVM and the Local Storage do not appear in df -h as they do not have a fstab entry. However, you can see it inside XenServer.

Inside the main partition

(this is least disearable option as the available space is very small, however it is the easiest to be done)

  1. Create the directory “/var/opt/xen/iso_library/”
    mkdir -p /var/opt/xen/iso_library
  2. Create the ISO storage repository with the following command
    xe sr-create name-label ="ISO Repository" type=iso device-config:location=/var/opt/xen/iso_library/ device-config:legacy_mode=true content-type=iso
  3. Transfer your ISO image in /var/opt/xen/iso_library/ with wget or FTP
  4. Login in Citrix XenCenter and you will now see the new repository. Press Rescan to refresh the images inside

Inside the Local Storage

If you want to create an local ISO repository inside the Local Storage on Citrix you can use:

xe sr-create name-label=ISO type=iso device-config:location=LOCATION device-config:legacy_mode=true content-type=iso

where LOCATION can be your Local Storage. You can find it out with:

df -h

Inside the LVM

  1. Check the free space inside LVM
    pvscan

    . It will output something like this: 

    [[email protected] xen]# pvscan
      PV /dev/sda3   VG VG_XenStorage-62a2ed30-1f21-1fe1-22f8-73adf2062d50   lvm2 [457.75 GB / 362.58 GB free]
      Total: 1 [457.75 GB] / in use: 1 [457.75 GB] / in no VG: 0 [0   ]
  2. Create LVM Space for ISO Repository
    lvcreate -L 15G -n ISO VG_XenStorage-62a2ed30-1f21-1fe1-22f8-73adf2062d50

    (replace the VVG… with your date from pvscan), and make it active

    vgchange -a y
  3. Format the new space
    mkfs.ext3 /dev/VG_XenStorage-62a2ed30-1f21-1fe1-22f8-73adf2062d50/ISO
  4. Mount the ISO Repository
    mkdir /mnt/iso_import
    mount /dev/VG_XenStorage-62a2ed30-1f21-1fe1-22f8-73adf2062d50/ISO /mnt/iso_import/

    and edit /etc/rc.local to put auto mount on boot (do not add it into /etc/fstab!). Add the following text at the end of the file

    [...]
    # Mount ISO
    vgchange -a y
    mount /dev/VG_XenStorage-62a2ed30-1f21-1fe1-22f8-73adf2062d50/ISO /mnt/iso_import/
  5. Create the following softlink
    rmdir /var/opt/xen/iso_import
    ln -s /mnt/iso_import /var/opt/xen
  6. Create the the repository
    xe sr-create name-label=ISO type=iso device-config:location=/mnt/iso_import/ device-config:legacy_mode=true content-type=iso
  7. Reboot to be sure that all works fine
  8. 8. Transfer your ISO image in /var/opt/xen/iso_import/ with wget or FTP
  9. Login in Citrix XenCenter and you will now see the new repository. Press Rescan to refresh the images inside.

 Source:  Internet


About NhocConan

A super lazy guy who tries to write tech blog entries in English. He is lazy, so he can only write when he is in a good mood or when he is tired of coding.

Leave a comment

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