Adding a new disk in XenServer 6.2 different from the general Linux process. For XenServer 6.2, you need to create a ‘storage repository’ to define a particular storage target, in which Virtual Disk Images (VDIs) of VMs are stored.
A VDI is nothing but an abstracted storage space which acts as the hard-disk for VMs.
Steps to create an SR in a XenServer.
1. SSH to the XenServer as root.
2. Find the disk ID of the new device using the following commands:
# cat /proc/partitions
You will see list of all the HDDs and partitions. Find which device is your new local disk. In My case it is sdb, which is highlight below.
[root@hv2 ~]# cat /proc/partitions major minor #blocks name 7 0 52252 loop0 8 0 488386584 sda 8 1 4193297 sda1 8 2 4193297 sda2 8 3 479996935 sda3 8 16 488386584 sdb 252 0 4096 dm-0
Now use following command to list the disk IDs
# ll /dev/disk/by-id
[root@hv2 ~]# ll /dev/disk/by-id/ total 0 lrwxrwxrwx 1 root root 9 Oct 21 03:14 edd-int13_dev81 -> ../../sdb lrwxrwxrwx 1 root root 9 Oct 21 03:14 scsi-SATA_WDC_WD5003ABYX-_WD-WMAYP1416704 -> ../../sdb lrwxrwxrwx 1 root root 9 Oct 21 03:14 scsi-SATA_WDC_WD5003ABYX-_WD-WMAYP2649256 -> ../../sda lrwxrwxrwx 1 root root 10 Oct 21 03:14 scsi-SATA_WDC_WD5003ABYX-_WD-WMAYP2649256-part1 -> ../../sda1 lrwxrwxrwx 1 root root 10 Oct 21 03:14 scsi-SATA_WDC_WD5003ABYX-_WD-WMAYP2649256-part2 -> ../../sda2 lrwxrwxrwx 1 root root 10 Oct 21 03:14 scsi-SATA_WDC_WD5003ABYX-_WD-WMAYP2649256-part3 -> ../../sda3
Find the disk ID of the disk you noted in step 1, in my case it was sdb, which i have highlighted above as well.
Now find the host UUID for XenSserver using the following command.
#xe host-list
[root@hv2 ~]# xe host-list uuid ( RO) : 685c8389-52bb-4958-b0ab-cd981918d610 name-label ( RW): hv2.innotech-sa.com name-description ( RW): Default install of XenServer
see the highlighted line above which says uuid ( RO).
now we have all the information for adding new disk. lets create sr now.
Note: The sr-create command is for adding a new hard drive. This is a destructive process that will partition and format the drive, and any data on the drive will be lost. If you wish to re-introduce a drive that contains existing data, you should use sr-introduce instead.
# xe sr-create content-type=user device-config:device=/dev/disk/by-id/
In my case exact command will be
#xe sr-create content-type=user device-config:device=/dev/disk/by-id/scsi-SATA_WDC_WD5003ABYX-_WD-WMAYP1416704 host-uuid=685c8389-52bb-4958-b0ab-cd981918d610 name-label=”Local Storage 2” shared=false type=lvm
We are done, You can verify it from XenCenter with the following steps:
1. Connect to the XenCenter.
2. Go to the ‘Storage tab’. You will find the details of all storage repositories here. You can see the storage ‘Local Storage2’ in the list.
This signifies that the disk has been added successfully. Now, you can start creating VDIs on it.
Out of so many other “guides” I found, this was the only one that worked. Specifically, you gave me the exact command you used. This helped me compare it to my environment and I had a better idea of what the commands were looking for.