...
The first step is to run the pvdisplay
command. This will show what is available on the physical disks. We see that the second disk contains one physical LVM volume with 1.5 TByte of data.
No Format |
---|
[root@server15 ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda3
VG Name VG_XenStorage-2a1d94fd-229b-29ea-0052-535698883e59
PV Size 1.36 TB / not usable 7.25 MB
Allocatable yes
PE Size (KByte) 4096
Total PE 355648
Free PE 353525
Allocated PE 2123
PV UUID uRowsc-slAI-33dG-0Cln-UtQ9-d7eb-uTx6aI
--- Physical volume ---
PV Name /dev/sdb1
VG Name VG_XenStorage-416a31b7-24a1-96b3-2984-901114b1155e
PV Size 1.36 TB / not usable 7.25 MB
Allocatable yes
PE Size (KByte) 4096
Total PE 357696
Free PE 357437
Allocated PE 259
PV UUID YmRdHu-tAbB-zz0C-V20t-2AKN-fV5Z-rRkGNa
|
The VG name contains the uuid which we need for the xe sr-introduce
command. This command will make the SR known to XenServer.
No Format |
---|
[root@server15 ~]# xe sr-introduce uuid=416a31b7-24a1-96b3-2984-901114b1155e type=lvm name-label="Local storage 2" content-type=user
416a31b7-24a1-96b3-2984-901114b1155e
|
The new SR will now show up in XenCenter but it is still marked as "Detached". We still have to connect the physical block device (PBD) with the SR. This is done by running the xe pbd-create
command which needs the device name (so we run ls -l /dev/disk/by-id
to find this out) and the host-uuid (we run xe host-list
to get this). In this case, The partition on the physical block device we want to reconnect is /dev/sdb1
. The corresponding disk id is scsi-SATA_SAMSUNG_HD154UIS24EJ9BZB02485-part1
which is used in the device-config
parameter in the xe pbd-create
command.
Finally, we need to activate the whole thing by executing xe pdb-plug
.
No Format |
---|
[root@server15 ~]# ls -l /dev/disk/by-id total 0 lrwxrwxrwx 1 root root 9 Sep 5 21:43 scsi-SATA_SAMSUNG_HD154UIS24EJ9BZB02485 -> ../../sdb lrwxrwxrwx 1 root root 10 Sep 5 21:43 scsi-SATA_SAMSUNG_HD154UIS24EJ9BZB02485-part1 -> ../../sdb1 lrwxrwxrwx 1 root root 9 Sep 5 21:43 scsi-SATA_SAMSUNG_HD154UIS24EJ9BZB02486 -> ../../sda lrwxrwxrwx 1 root root 10 Sep 5 21:43 scsi-SATA_SAMSUNG_HD154UIS24EJ9BZB02486-part1 -> ../../sda1 lrwxrwxrwx 1 root root 10 Sep 5 21:43 scsi-SATA_SAMSUNG_HD154UIS24EJ9BZB02486-part2 -> ../../sda2 lrwxrwxrwx 1 root root 10 Sep 5 21:43 scsi-SATA_SAMSUNG_HD154UIS24EJ9BZB02486-part3 -> ../../sda3 [root@server15 ~]# xe host-list uuid ( RO) : 767266f8-133e-4497-b332-72d495d33e8e name-label ( RW): server15 name-description ( RW): Default install of XenServer [root@server15 ~]# xe pbd-create host-uuid=767266f8-133e-4497-b332-72d495d33e8e sr-uuid=416a31b7-24a1-96b3-2984-901114b1155e \ device-config:device=/dev/disk/by-id/scsi-SATA_SAMSUNG_HD154UIS24EJ9BZB02485-part1 ae239dca-4ed7-9a35-1d76-52f81bdcf65b [root@server15 ~]# xe pbd-plug uuid=ae239dca-4ed7-9a35-1d76-52f81bdcf65b |
The SR should now be usable in XenCenter control panel. However, note that all names and descriptions of the partitions as well as their associations with virtual machines are unavailable, because this meta data is stored somewhere else.
Remove a disk from XenServer
To remove a disk from XenServer, we have to reverse the actions described above: disconnect the PBD from the SR using xe pdb-unplug
, then forget about the SR using xe sr-forget
. Use xe pbd-list
and xe sr-list
to find out the respective uuids.
No Format |
---|
[root@server15 ~]# xe pbd-list
...
uuid ( RO) : ae239dca-4ed7-9a35-1d76-52f81bdcf65b
host-uuid ( RO): 767266f8-133e-4497-b332-72d495d33e8e
sr-uuid ( RO): 416a31b7-24a1-96b3-2984-901114b1155e
device-config (MRO): device: /dev/disk/by-id/scsi-SATA_SAMSUNG_HD154UIS24EJ9BZB02485-part1
currently-attached ( RO): true
[root@server15 ~]# xe pbd-unplug uuid=ae239dca-4ed7-9a35-1d76-52f81bdcf65b
[root@server15 ~]# xe sr-list
...
uuid ( RO) : 2a1d94fd-229b-29ea-0052-535698883e59
name-label ( RW): Local storage
name-description ( RW):
host ( RO): server15
type ( RO): lvm
content-type ( RO): user
uuid ( RO) : 416a31b7-24a1-96b3-2984-901114b1155e
name-label ( RW): Local storage 2
name-description ( RW):
host ( RO): server15
type ( RO): lvm
content-type ( RO): user
[root@server15 ~]# xe sr-forget uuid=416a31b7-24a1-96b3-2984-901114b1155e
|