Saturday, March 27, 2010

XenServer Install: Adding local storage repositories

If you remember one of my tips during the XenServer install, it was to not select all your local storage as repotitory during the installation. The reason for this is that I want to add the different disks I have as different storage repositories in order to control which of my RAIDs are used for system disks and data disks. I fount this brilliant blog http://www.archy.net/2009/05/21/adding-local-storage-to-xenserver-55/ that describes the process, but I am going to repeat Stephane´s actions here.

First we need to detect the drives we want to add. This we do by running a "fdisk -l". In my case I see several disks, but the ones I am interested in is my datadisk and a non-Raid backupdisk:
Disk /dev/sdb: 3000.4 GB, 3000409915392 bytes
255 heads, 63 sectors/track, 364779 cylinders
Units = cylinders of 16065 * 512 = 8225280 byte

Disk /dev/sdc: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
From this listing I can see that it is /dev/sdb and /dev/sdc that I want to add.

I then run pvcreate on these disks:
pvcreate /dev/sdb
pvcreate /dev/sdc
Then you need to find the disks id string in the /dev/disk/by_id folder. Listing my folder reviles my disks
scsi-27f1dad4b7c900104 -> ../../sdb
scsi-SATA_SAMSUNG_HD252HJS17HJ90S401838 -> ../../sdc
As you can see scsi-27f1dad4b7c900104 is id for sdb and scsi-SATA_SAMSUNG_HD252HJS17HJ90S401838 is id for sdc. The reason we do this is that incase we change the order of our disks or controllers (for instance adding a local SATA disk may add a new sdb and push the other disks down to sdc and sdd).
Ok, next we do some XenServer magic to add the storage repositories.

xe sr-create type=lvm content-type=user device-config:device=/dev/disk/by-id/scsi-27f1dad4b7c900104 name-label="DATA SR"

xe sr-create type=lvm content-type=user device-config:device=/dev/disk/by-id/scsi-SATA_SAMSUNG_HD252HJS17HJ90S401838 name-label="BACKUP SR"

That is it.

In my next blog, I will add a local ISO repos to hold the most used ISOs I use to install servers.

No comments:

Post a Comment