XCP-ng: Create local storage using LVM
Create local storage under XCP-ng as follows.
Add the new disk to the environment:
[11:47 xcpng03 sm]# fdisk -l|grep Disk
Disk /dev/sdc: 4398.0 GB, 4398046511104 bytes, 8589934592 sectors
[11:50 xcpng03 sm]#
Now the next set of steps here were incorrect. We were under the impression that we need to create the LV as with GlusterFS. That's not the case. We can add the raw device directly. Just skip to the last portion if you want to jump over the POC / troubleshooting bits below:
INCORRECT WAY:
[07:27 xcpng02 ~]# blkid /dev/mapper/vmsrvg-vmsrlv
/dev/mapper/vmsrvg-vmsrlv: UUID="e8a3b25f-42ec-4b20-8d28-5925449cda80" TYPE="xfs"
[07:27 xcpng02 ~]# xe host-list
uuid ( RO) : c133b4f5-61ab-4f82-b517-854e9277cfcd
name-label ( RW): xcpng02.nix.mds.xyz
name-description ( RW): Default install
[07:30 xcpng02 ~]# xe sr-create content-type=user device-config:device=/dev/disk/by-id/dm-uuid-LVM-pirJM0blfRvI8f65frH3fyN21jA2dqGBQxYeS2RpmAG2gieD7TpaCObO2a1mwHdw host-uuid=c133b4f5-61ab-4f82-b517-854e9277cfcd name-label="LVM /dev/sdb" shared=false type=lvm The SR operation cannot be performed because a device underlying the SR is in use by the host.
[07:32 xcpng02 ~]#
[07:32 xcpng02 ~]#
[07:32 xcpng02 ~]#
[07:32 xcpng02 ~]# umount /mnt/vmsr/
[07:33 xcpng02 ~]# vi /etc/fstab
[07:33 xcpng02 ~]# ll /dev/disk/by-id
total 0
lrwxrwxrwx 1 root root 9 Oct 12 12:47 ata-VMware_Virtual_IDE_CDROM_Drive_10000000000000000001 -> ../../sr0
lrwxrwxrwx 1 root root 10 Oct 13 06:52 dm-name-vmsrvg-vmsrlv -> ../../dm-0
lrwxrwxrwx 1 root root 10 Oct 13 06:52 dm-uuid-LVM-pirJM0blfRvI8f65frH3fyN21jA2dqGBQxYeS2RpmAG2gieD7TpaCObO2a1mwHdw -> ../../dm-0
[07:33 xcpng02 ~]#
[07:33 xcpng02 ~]# xe sr-create content-type=user device-config:device=/dev/disk/by-id/dm-uuid-LVM-pirJM0blfRvI8f65frH3fyN21jA2dqGBQxYeS2RpmAG2gieD7TpaCObO2a1mwHdw host-uuid=c133b4f5-61ab-4f82-b517-854e9277cfcd name-label="LVM /dev/sdb" shared=false type=lvm
470a3300-f74f-be61-68b1-590a39bba7a8
[07:33 xcpng02 ~]# echo $?
0
[07:33 xcpng02 ~]#
Storage will appear automatically under the XCP-ng Center 8.X . This however may result in:
boot.log:[ TIME ] Timed out waiting for device dev-mapper-vmsrvg\x2dvmsrlv.device.
If this happens, use the following method instead:
xe sr-create name-label="LDS 256G" shared=false device-config:device=/dev/vmsrvg/vmsrlv type=lvm content-type=user
CORRECT WAY
However this was still incorrect. Because XCP-ng tried to create the LVM within the LVM itself. What we need is to specify the block device:
xe sr-create name-label="LDS 256G" shared=false device-config:device=/dev/sdb type=lvm content-type=user
This appears to persist through reboots.
Thx,
REF: https://support.citrix.com/article/CTX121313