{"id":1363,"date":"2020-09-25T10:49:41","date_gmt":"2020-09-25T10:49:41","guid":{"rendered":"http:\/\/howden.net.au\/thowden\/?p=1363"},"modified":"2020-09-25T11:13:23","modified_gmt":"2020-09-25T11:13:23","slug":"xcp-ng-xen-server-adding-a-new-sr-storage-repository","status":"publish","type":"post","link":"https:\/\/howden.net.au\/thowden\/2020\/09\/xcp-ng-xen-server-adding-a-new-sr-storage-repository\/","title":{"rendered":"XCP-Ng Xen Server Adding a New SR Storage Repository"},"content":{"rendered":"\n<p>An update to my previous posts on XCP-Ng Xen Server Adding a New SR Storage Repository. <\/p>\n\n\n\n<p>My earlier posts, quite a while ago, <a href=\"\/2015\/07\/xenserver-install-without-local-storage\/\">Xen Server install without local storage<\/a> and <a href=\"\/2015\/07\/xenserver-has-no-local-storage\/\">Xen Server has no local storage<\/a>, were written for Xen but equally apply to XCP-ng which is my preferred platform.  <\/p>\n\n\n\n<p>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. <\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>Accessing the XCP-ng centre console (yes, I know XenOrchestra exists, but I am really ok working with the center console and the CLI). <\/p>\n\n\n\n<p>So first up I need to find the array information from the console:<\/p>\n\n\n\n<p><code># fdisk -l <\/code><br><code>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 <\/code><br><br><code>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 <\/code><\/p>\n\n\n\n<p>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 &#8216;parted&#8217; to create the volume \/ partition. In this example I was on another system with a 3Tb drive array (4x 1T disks, RAID 5)<\/p>\n\n\n\n<p><code>#parted \/dev\/sdb<br>(parted) mklabel GPT<br>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?<br> Yes\/No? yes                                                                <br>(parted) mkpart Partition name?  []? primary                                               <br>File system type?  [ext2]? ext4                                            <br>Start? 2048s                                                               <br>End? 100%                                                                  <br>(parted) print                                                             <br>Model: HP LOGICAL VOLUME (scsi) <\/code><br><code>Disk \/dev\/sdb: 3001GB <\/code><br><code>Sector size (logical\/physical): 512B\/512B <\/code><br><code>Partition Table: gpt <\/code><br><code>Disk Flags:<\/code><br><code>  Number  Start   End     Size    File system  Name     Flags  <\/code><br><code>1      1049kB  3001GB  3001GB               primary <\/code><br><code>(parted)q  <\/code><br><code>#<\/code><\/p>\n\n\n\n<p>Now we have a configured partition it needs to be formatted:<\/p>\n\n\n\n<p><code>#  mkfs.ext4 \/dev\/sdb1                                     <\/code><br><code>mke2fs 1.42.9 (28-Dec-2013) <\/code><br><code>Filesystem label= <\/code><br><code>OS type: Linux <\/code><br><code>Block size=4096 (log=2) <\/code><br><code>Fragment size=4096 (log=2) <\/code><br><code>Stride=0 blocks, Stripe width=0 blocks <\/code><br><code>183140352 inodes, 732546816 blocks <\/code><br><code>36627340 blocks (5.00%) reserved for the super user <\/code><br><code>First data block=0 <\/code><br><code>Maximum filesystem blocks=2881486848 <\/code><br><code>22356 block groups <\/code><br><code>32768 blocks per group, 32768 fragments per group <\/code><br><code>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 <\/code><br><code>Allocating group tables: done                             <\/code><br><code>Writing inode tables: done                             <\/code><br><code>Creating journal (32768 blocks): done <\/code><br><code>Writing superblocks and filesystem accounting information:done    <\/code><\/p>\n\n\n\n<p>and then it can be used for a XCP-ng \/ Xen Storage Repository, but it needs a few bits of info for the command:<\/p>\n\n\n\n<p>xe sr-create content-type=user  device-config:device=<strong>&lt;disk device identifier&gt;<\/strong>  host-uuid=<strong>&lt;host uuid that the SR is on&gt;<\/strong> name-label=\u201d<strong>A nice name label<\/strong>\u201d shared=false type=lvm <\/p>\n\n\n\n<p><code> xe host-list <\/code><br><code>uuid ( RO)                : 19458bfa-48e3-42d1-b345-266j6fdq4ed6f<\/code><br><code>           name-label ( RW): my-svr-name<\/code><br><code>name-description ( RW): Default install of XenServer<\/code><\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<p><code># ls -lah \/dev\/disk\/by-id | grep sdb <\/code><br><code>lrwxrwxrwx  1 root root   9 Sep 25 19:26 scsi-3600508b400dc45c8k47fe45763a27qq8 -&gt; ..\/..\/sdb <\/code><br><code>lrwxrwxrwx  1 root root  10 Sep 25 19:26 scsi-3600508b400dc45c8k47fe45763a27qq8-part1 -&gt; ..\/..\/sdb1 lrwxrwxrwx  1 root root   9 Sep 25 19:26 wwn-0x600518b1001q45c8887fe45764a27bb8 -&gt; ..\/..\/sdb <\/code><br><code>lrwxrwxrwx  1 root root  10 Sep 25 19:26 wwn<\/code>&#8211;<code>0x600518b1001q45c8887fe45764a27bb8-part1 -&gt; ..\/..\/sdb1<\/code><\/p>\n\n\n\n<p>Using the above codes in the sr-create command should look like this:<\/p>\n\n\n\n<p><code>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=\u201dLocal Storage 2\u201d shared=false type=lvm<\/code><\/p>\n\n\n\n<p>and a final check to confirm (aside from looking at the new SR in the XCP-ng center console) is to use:<\/p>\n\n\n\n<p><code># xe sr-list <\/code><\/p>\n\n\n\n<p>and review the list for Local Storage 2 device. <\/p>\n\n\n\n<p>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 <a href=\"\/how-to-change-the-storage-repository-label-for-xen-xcp-ng\">How to change the Xen XCP-ng Storage Repository label and description from the Command Line<\/a>. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1363","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/posts\/1363","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/comments?post=1363"}],"version-history":[{"count":11,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/posts\/1363\/revisions"}],"predecessor-version":[{"id":1376,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/posts\/1363\/revisions\/1376"}],"wp:attachment":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/media?parent=1363"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/categories?post=1363"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/tags?post=1363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}