Create Linux LVM partition
The first step is to write a new partition table on the second disk drive using the fdisk
command.
Device Boot Start End Blocks Id System
/dev/sdb1 1 182401 1465136001 8e Linux LVM
Add new disk to XenServer LVM
The next step is to make the new disk partition known to the LVM using the pvcreate
command. The pvdisplay
command lists all physical volumes associated with LVM. The first physical volume is the original XenServer LVM partition on the first disk, the second entry is our new one.
# pvcreate /dev/sdb1 --config global{metadata_read_only=0}
Physical volume "/dev/sdb1" successfully created
# pvdisplay
--- Physical volume ---
PV Name /dev/sda3
VG Name VG_XenStorage-506b833c-f239-ad9a-350f-a7287ed3e259
PV Size 1.36 TB / not usable 7.77 MB
Allocatable yes
PE Size (KByte) 4096
Total PE 355739
Free PE 340336
Allocated PE 15403
PV UUID 5bhPOM-r7J0-2cSV-2CnR-WKpI-Vzue-AJorZZ
-
"/dev/sdb1" is a new physical volume of "1.36 TB"
--- NEW Physical volume ---
PV Name /dev/sdb1
VG Name VG_XenStorage-f6bce4ea-0bff-74f0-7a35-55238d517bd4
PV Size 1.36 TB / not usable 7.25 MB
Allocatable yes
PE Size (KByte) 4096
Total PE 357696
Free PE 132
Allocated PE 357564
PV UUID 2z9UKx-eTRo-I42j-O120-4F37-i5Is-edTbX8
#
Complete the following procedure to create a Storage Repository (SR) on a new local hard drive (HDD):
Note: The stored data in the server will be lost.
xe sr-create name-label="Locale Storage 1.36 TB HDD" shared=false device-config:device=/dev/sdb1 type=lvm content-type=user
Run the following command to find the disk ID of the new device:
# cat /proc/partitions
A list of HDDs and partitions are displayed. Find out which device is your new local disk. Locate it by size. (This is probably “sdb” or “/cciss/c0d1p0”)
# ll /dev/disk/by-id
Find the disk ID of the “sdb” or “cciss/c0d1”disk. The “scsi-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx” or “cciss-xxxxxxxxxxxxxxxxxxxxxxxxxx”format is required.
Run the following command to create an SR:
# xe sr-create content-type=user device-config:device=/dev/disk/by-id/ host-uuid= name-label=”Local Storage 2” shared=false type=lvm
Or
# xe sr-create content-type=user device-config:device=/dev/disk/by-id/ host-uuid= name-label=”Local Storage 2” shared=false type=lvm