Create local Intellicache Storage Repository after Installation

One thing that is really missing in XenCenter is the possibility to create local storage repositories. So if you missed to create one during installation, or just want to add more local hdd capacity you have to use the commandline. Come one Citrix – this sucks! – we should have a GUI for this in a Enterprise Product, right?!

I recently added a local SSD to my XenServer to check out Intellicache. The SSD was added in addition to the local HDD so it became device /dev/sdb. First I had to remove all existing partitions using fdisk.

[root@xenserver01 ~]# fdisk /dev/sdb

The number of cylinders for this disk is set to 19457.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sdb: 256.0 GB, 256060514304 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 13 102400 7 HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sdb2 13 19458 156185600 7 HPFS/NTFS

Command (m for help): d
Partition number (1-4): 1

Command (m for help): d
Selected partition 2

Command (m for help): p

Disk /dev/sdb: 256.0 GB, 256060514304 bytes
255 heads, 63 sectors/track, 31130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

After this i checked the SSD for partitions using “p”, found /dev/sdb1 /dev/sdb2 and deleted them using “d” 1,2. I verified that both partitions are deleted using “p” again. Next step is to create a default linux partition with max size (you have to use EXT3 filesystem as local SR for Intellicache) using “n”. Finally I had to write the partition table back to disk and quit using “w” and “q”.

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-31130, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-31130, default 31130):
Using default value 31130
Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

Now I had to introduce the newly created SSD partition (/dev/sdb1) to XenServer using the xe command.

xe sr-create host=xenserver01 content-type=user type=ext device-config:device=/dev/sdb1 shared=false name-label="localssd"

I got back the UUID of the newly created local SR and it occured XenCenter. In this example the UUID is “ad918078-aca8-2a76-81fd-7bbc4b2ba462″

Next I had to configure the Storage Repository as Intellicache. Before I disabled (enable maintainance mode) XenServer.

[root@xenserver01 ~]# xe host-disable host=xenserver01
[root@xenserver01 ~]# xe host-disable-local-storage-caching host=xenserver01

[root@xenserver01 ~]# xe host-enable-local-storage-caching host=xenserver01 sr-uuid=ad918078-aca8-2a76-81fd-7bbc4b2ba462

This did the job – now I could verify the configuration by listing the host properties using “xe host-param-list”. This showed the configuration of the local SR configured for Intellicache “local-cache-sr”. To double-check if Intellicache functionality is enabled on the SR “xe sr-param-list” could be used. Check for the correct value of “local-cache-enabled value”.

[root@xenserver01 ~]# xe host-param-list uuid=c0251040-2ca1-4052-8f2e-aa764ce827e3
local-cache-sr ( RO): ad918078-aca8-2a76-81fd-7bbc4b2ba462
[root@xenserver01 ~]# xe sr-param-list uuid=ad918078-aca8-2a76-81fd-7bbc4b2ba462 | grep -i local-cache-enabled
local-cache-enabled ( RO): true