XCP-Ng Xen Server Adding a New SR Storage Repository

An update to my previous posts on XCP-Ng Xen Server Adding a New SR Storage Repository.

My earlier posts, quite a while ago, Xen Server install without local storage and Xen Server has no local storage, were written for Xen but equally apply to XCP-ng which is my preferred platform.

In preparing some new servers and adding disks today I again found a need for formatting beyond the 2Tbyte limit of fdisk and decided I should document the process for future reference.

The configuration of the RAID array belongs with the controller, and regardless of the combination the following should apply to any RAID config. In this case I have installed 6 1Tbyte drives as RAID 50 with a useable array capacity of ~4Tbytes.

Accessing the XCP-ng centre console (yes, I know XenOrchestra exists, but I am really ok working with the center console and the CLI).

So first up I need to find the array information from the console:

# fdisk -l
Disk /dev/sda: 1000.2 GB, 1000171331584 bytes, 1953459632 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: gpt

Disk /dev/sdb: 4000.7 GB, 4000684662784 bytes, 7813837232 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes

Ok, so I can see the original Local Storage /dev/sda and the new RAID space is /dev/sdb and now I want to use ‘parted’ to create the volume / partition. In this example I was on another system with a 3Tb drive array (4x 1T disks, RAID 5)

#parted /dev/sdb
(parted) mklabel GPT
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
(parted) mkpart Partition name? []? primary
File system type? [ext2]? ext4
Start? 2048s
End? 100%
(parted) print
Model: HP LOGICAL VOLUME (scsi)

Disk /dev/sdb: 3001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 3001GB 3001GB primary
(parted)q
#

Now we have a configured partition it needs to be formatted:

# mkfs.ext4 /dev/sdb1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
183140352 inodes, 732546816 blocks
36627340 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2881486848
22356 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000, 214990848, 512000000, 550731776, 644972544
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information:done

and then it can be used for a XCP-ng / Xen Storage Repository, but it needs a few bits of info for the command:

xe sr-create content-type=user device-config:device=<disk device identifier> host-uuid=<host uuid that the SR is on> name-label=”A nice name label” shared=false type=lvm

xe host-list
uuid ( RO) : 19458bfa-48e3-42d1-b345-266j6fdq4ed6f
name-label ( RW): my-svr-name
name-description ( RW): Default install of XenServer

The ls command below will show all the /sdb devices. Use the /dev/sdb1 scsi code to identify the partition that will be the storage repository.

# ls -lah /dev/disk/by-id | grep sdb
lrwxrwxrwx 1 root root 9 Sep 25 19:26 scsi-3600508b400dc45c8k47fe45763a27qq8 -> ../../sdb
lrwxrwxrwx 1 root root 10 Sep 25 19:26 scsi-3600508b400dc45c8k47fe45763a27qq8-part1 -> ../../sdb1 lrwxrwxrwx 1 root root 9 Sep 25 19:26 wwn-0x600518b1001q45c8887fe45764a27bb8 -> ../../sdb
lrwxrwxrwx 1 root root 10 Sep 25 19:26 wwn0x600518b1001q45c8887fe45764a27bb8-part1 -> ../../sdb1

Using the above codes in the sr-create command should look like this:

xe sr-create content-type=user device-config:device=/dev/disk/by-id/scsi-3600508b400dc45c8k47fe45763a27qq8-part1 host-uuid=19458bfa-48e3-42d1-b345-266j6fdq4ed6f name-label=”Local Storage 2” shared=false type=lvm

and a final check to confirm (aside from looking at the new SR in the XCP-ng center console) is to use:

# xe sr-list

and review the list for Local Storage 2 device.

The only issue I had was when I copy/pasted the sr-create command and missed the double quotes being converted. Thats the topic of the next post How to change the Xen XCP-ng Storage Repository label and description from the Command Line.

Leave a Reply

Your email address will not be published. Required fields are marked *