Citrix XenServer

XenServer comes by default with very low available space. This creates a problem when you have an ISO file that is bigger than currently available space. Today I ran to this problem and after some tinkering I found the solution. I created on my XenServer local ISO storage on a new partition.

To get my ISO available for the new VM installations I had to find some free space for it. I had no NFSes on the network or any other network storages. Creating an NFS inside the host as a new VM (as I found on Google) was not an option for me. Which came to my mind is to simply create a new partition on the server’s hard drive and simply create a new ISO repository on it.

Here is how I did it.

Get logged in into the console

At first you need to log to your XenServer over SSH, on root account. Once you get logged in, enter xsconsole command and choose Local Command Shell option.

Local Command Shell inside xsconsole

Local Command Shell inside xsconsole

It is very important to use the command shell through xsconsole, because by connecting directly over SSH you will not have access to required later tools.

Create new partition

1. Execute pvscan command and find out your volume group name:

[root@xenserver-ryblorpz xen]# pvscan
  PV /dev/sda3   VG VG_XenStorage-864ffd62-caaa-a4f3-72fa-4eb48a4dc233   lvm2 [3,63 TB / 1,61 TB free]
  Total: 1 [3,63 TB] / in use: 1 [3,63 TB] / in no VG: 0 [0   ]

2. Create a new volume. The -L parameter specifies volume size, adjust it to your needs.

[root@xenserver-ryblorpz xen]# lvcreate -L 15G -n ISOs VG_XenStorage-864ffd62-caaa-a4f3-72fa-4eb48a4dc233

3. Obtain path to your newly created volume (it should be the last one on the list):

[root@xenserver-ryblorpz xen]# [root@xenserver-ryblorpz xen]# lvscan 
(...)
  ACTIVE   '/dev/VG_XenStorage-864ffd62-caaa-a4f3-72fa-4eb48a4dc233/VHD-458c1c62-5b5d-46e2-a01e-e938472dbc7e' [8,02 GB] inherit
  ACTIVE   '/dev/VG_XenStorage-864ffd62-caaa-a4f3-72fa-4eb48a4dc233/ISOs' [15,00 GB] inherit

4. Create a filesystem on the volume. Ext2 is very fine for this simple purpose, but you can use whatever you want.

[root@xenserver-ryblorpz xen]# mkfs.ext2 /dev/VG_XenStorage-864ffd62-caaa-a4f3-72fa-4eb48a4dc233/ISOs

5. Prepare a mountpoint where you want to store your ISO files:

[root@xenserver-ryblorpz xen]# mkdir /mnt/isos

 

Create a new XenServer local ISO repository

1. Execute the following command to create a new XenServer local ISO repository :

[root@xenserver-ryblorpz xen]# xe sr-create name-label=ISOs type=iso device-config:legacy_mode=true device-config:location=/mnt/isos content-type=iso

2. Mount the newly created volume to the mountpoint:

[root@xenserver-ryblorpz xen]# mount -t ext2 /dev/VG_XenStorage-864ffd62-caaa-a4f3-72fa-4eb48a4dc233/ISOs /mnt/isos

3. Copy your ISO files to the mountpoint. Remember to place .ISO files in the root directory of the mount point, do not use any folders!!! To copy files you can use for example sftp of wget tools, ie:

[root@xenserver-ryblorpz xen]# cd /mnt/isos && wget http://example.com/myOS.iso

4. Log in to the XenCenter and rescan your ISO repository:

Rescanning XenServer local ISO repository

Rescanning XenServer local ISO repository

Once your ISO files appear in the repository, you can use them to install new VMs.

Learn more about XenServer