Making use of the unused space on a xenserver root disk install

I don’t know about you, but I try to install the OS of xenserver on it’s own disk.

On one of my boxes, I used a 16G ssd for the install, and a 1t array for the VMs.

Since the array is much faster than the ssd, I don’t want to mix local storage and raid storage for the VMs.. so I made sure to uncheck the unused space on the root ssd (/dev/sda in my case) from the list of block devices to use for VMs when installing Xenserver.

This left /dev/sda3 as an LVM partition type, but completely unused.

So… I created a Physical Volume:

[root@phoenix ~]# pvcreate /dev/sda3
 Physical volume "/dev/sda3" successfully created

Then a Volume Group:

[root@phoenix ~]# vgcreate LocalStorageVG /dev/sda3
Volume group "LocalStorageVG" successfully created
[root@phoenix ~]# vgdisplay LocalStorageVG
--- Volume group ---
VG Name LocalStorageVG
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
Cur LV 1
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 6.91 GB
PE Size 4.00 MB
Total PE 1769
Alloc PE / Size 512 / 2.00 GB
Free PE / Size 1257 / 4.91 GB
VG UUID Cp58oc-ldUh-piLZ-N9vt-Lz27-QSri-hSMA2y
[root@phoenix ~]#

Then a Logical Volume

[root@phoenix ~]# lvcreate -L 2G -n LocalStorageLV LocalStorageVG
Logical volume "LocalStorageLV" created

Yay! Now lets make an ext3 filesystem on our new Logical Volume:

[root@phoenix ~]# mkfs.ext3 -L iso /dev/mapper/LocalStorageVG-LocalStorageLV
mke2fs 1.39 (29-May-2006)
Filesystem label=iso
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
262144 inodes, 524288 blocks
26214 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=536870912
16 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 25 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

[root@phoenix ~]#

Lets add it to fstab, and mount it:

[root@phoenix ~]# echo '/dev/mapper/LocalStorageVG-LocalStorageLV /iso/ ext3 defaults 0 0'>>/etc/fstab&&mount -a;mount


Now the sweetness: lets make a local iso storage repository:

[root@phoenix ~]# xe sr-create name-label="Local ISO" type=iso device-config:location=/iso device-config:legacy_mode=true content-type=iso

and in xencenter, you should now see your local iso repository… Login to the console and wget some ISOs and deposit them in /iso, and away you go.

Many thanks to Melvin Koh for his tip on how to make the local SR