{"id":171,"date":"2015-10-12T12:27:06","date_gmt":"2015-10-12T11:27:06","guid":{"rendered":"http:\/\/www.haxed.me.uk\/?p=171"},"modified":"2015-10-12T13:05:26","modified_gmt":"2015-10-12T12:05:26","slug":"extending-disk-sizes-with-lvm","status":"publish","type":"post","link":"https:\/\/haxed.me.uk\/index.php\/2015\/10\/12\/extending-disk-sizes-with-lvm\/","title":{"rendered":"Extending Disk Sizes with LVM"},"content":{"rendered":"<p>A lot of customers ask the question of how to have a data volume that can be incrementally increased in size vertically over a period of time. Here is how to setup a server like that from start to finish.<\/p>\n<p>Step 1. Create Rackspace Cloud server<\/p>\n<p><a href=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.21.40-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-172\" src=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.21.40-AM.png\" alt=\"Screen Shot 2015-10-12 at 11.21.40 AM\" width=\"732\" height=\"467\" srcset=\"https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.21.40-AM.png 732w, https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.21.40-AM-300x191.png 300w, https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.21.40-AM-470x300.png 470w\" sizes=\"auto, (max-width: 732px) 100vw, 732px\" \/><\/a><\/p>\n<p>Click create server at bottom left once you are happy with the distribution you want to use:<\/p>\n<p><a href=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.24.22-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-173\" src=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.24.22-AM.png\" alt=\"Screen Shot 2015-10-12 at 11.24.22 AM\" width=\"126\" height=\"64\" \/><\/a><\/p>\n<p>Step 2. Create Cloud Block Storage Volumes. In this case I&#8217;m going to create 3 x 75 Gig disks.<\/p>\n<p><a href=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.25.30-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-174\" src=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.25.30-AM.png\" alt=\"Screen Shot 2015-10-12 at 11.25.30 AM\" width=\"247\" height=\"245\" srcset=\"https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.25.30-AM.png 247w, https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.25.30-AM-150x150.png 150w, https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.25.30-AM-65x65.png 65w\" sizes=\"auto, (max-width: 247px) 100vw, 247px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.26.27-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-175\" src=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.26.27-AM.png\" alt=\"Screen Shot 2015-10-12 at 11.26.27 AM\" width=\"451\" height=\"388\" srcset=\"https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.26.27-AM.png 451w, https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.26.27-AM-300x258.png 300w, https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.26.27-AM-349x300.png 349w\" sizes=\"auto, (max-width: 451px) 100vw, 451px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.26.53-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-176\" src=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.26.53-AM.png\" alt=\"Screen Shot 2015-10-12 at 11.26.53 AM\" width=\"976\" height=\"242\" srcset=\"https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.26.53-AM.png 976w, https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.26.53-AM-300x74.png 300w, https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.26.53-AM-500x124.png 500w\" sizes=\"auto, (max-width: 976px) 100vw, 976px\" \/><\/a><\/p>\n<p>Now your done creating your server and the volumes you are going to use with it. We could have just added 1 Cloud block storage volume, and added the others later, but for this demo, we&#8217;re going to show you how to extend the initial partition with the space capacity of the other 2.<\/p>\n<p>Step 3. Attach your Cloud Block Storage Volumes to the server:<\/p>\n<p><a href=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.30.05-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-177\" src=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.30.05-AM.png\" alt=\"Screen Shot 2015-10-12 at 11.30.05 AM\" width=\"180\" height=\"207\" \/><\/a><\/p>\n<p><a href=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.30.25-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-178\" src=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.30.25-AM.png\" alt=\"Screen Shot 2015-10-12 at 11.30.25 AM\" width=\"512\" height=\"443\" srcset=\"https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.30.25-AM.png 512w, https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.30.25-AM-300x260.png 300w, https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-11.30.25-AM-347x300.png 347w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/a><\/p>\n<p>Step 4. Login to your Cloud Server<\/p>\n<pre>$ ssh root@37.188.117.229\r\nThe authenticity of host '37.188.1.1 (37.188.1.1)' can't be established.\r\nRSA key fingerprint is 51:e9:e6:c1:4b:f8:24:9f:2a:8a:36:ec:bf:47:23:d4.\r\nAre you sure you want to continue connecting (yes\/no)? yes\r\nWarning: Permanently added '37.188.1.1' (RSA) to the list of known hosts.\r\nLast login: Thu Jan  1 00:00:10 1970\r\n<\/pre>\n<p>Step 5. Run fdisk -l (list) to see attached volumes to server<\/p>\n<p>Disk \/dev\/xvdc: 536 MB, 536870912 bytes, 1048576 sectors<br \/>\nUnits = sectors of 1 * 512 = 512 bytes<br \/>\nSector size (logical\/physical): 512 bytes \/ 512 bytes<br \/>\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes<br \/>\nDisk label type: dos<br \/>\nDisk identifier: 0x0004ece3<\/p>\n<p>Device Boot Start End Blocks Id System<br \/>\n\/dev\/xvdc1 2048 1048575 523264 83 Linux<\/p>\n<p>Disk \/dev\/xvda: 21.5 GB, 21474836480 bytes, 41943040 sectors<br \/>\nUnits = sectors of 1 * 512 = 512 bytes<br \/>\nSector size (logical\/physical): 512 bytes \/ 512 bytes<br \/>\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes<br \/>\nDisk label type: dos<br \/>\nDisk identifier: 0x000b1244<\/p>\n<p>Device Boot Start End Blocks Id System<br \/>\n\/dev\/xvda1 * 2048 41943039 20970496 83 Linux<\/p>\n<p>Disk \/dev\/xvdb: 80.5 GB, 80530636800 bytes, 157286400 sectors<br \/>\nUnits = sectors of 1 * 512 = 512 bytes<br \/>\nSector size (logical\/physical): 512 bytes \/ 512 bytes<br \/>\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes<\/p>\n<p>Disk \/dev\/xvdd: 80.5 GB, 80530636800 bytes, 157286400 sectors<br \/>\nUnits = sectors of 1 * 512 = 512 bytes<br \/>\nSector size (logical\/physical): 512 bytes \/ 512 bytes<br \/>\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes<\/p>\n<p>I actually discovered at this point that CentOS 7 only supports 3 virtual disks as standard. I&#8217;m having the issue because the Rackspace centOS 7 image is shipping with HVM which is causing the issues, if it was just PV type we would be okay. You should switch to a PV version of CentOS now if you want more than 3 virtual disks with your Rackspace Cloud Server.<\/p>\n<p>Step 5: Running the same command on a CentOS 6 PV server allows me to add more disks thru the control panel<\/p>\n<pre>[root@lvm-extend-test ~]# fdisk -l\r\n\r\nDisk \/dev\/xvdc: 536 MB, 536870912 bytes\r\n70 heads, 4 sectors\/track, 3744 cylinders\r\nUnits = cylinders of 280 * 512 = 143360 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\nDisk identifier: 0x000f037d\r\n\r\n    Device Boot      Start         End      Blocks   Id  System\r\n\/dev\/xvdc1               8        3745      523264   83  Linux\r\n\r\nDisk \/dev\/xvda: 21.5 GB, 21474836480 bytes\r\n255 heads, 63 sectors\/track, 2610 cylinders\r\nUnits = cylinders of 16065 * 512 = 8225280 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\nDisk identifier: 0x0003e086\r\n\r\n    Device Boot      Start         End      Blocks   Id  System\r\n\/dev\/xvda1   *           1        2611    20970496   83  Linux\r\n\r\nDisk \/dev\/xvdb: 80.5 GB, 80530636800 bytes\r\n255 heads, 63 sectors\/track, 9790 cylinders\r\nUnits = cylinders of 16065 * 512 = 8225280 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\nDisk identifier: 0x00000000\r\n\r\n\r\nDisk \/dev\/xvdd: 80.5 GB, 80530636800 bytes\r\n255 heads, 63 sectors\/track, 9790 cylinders\r\nUnits = cylinders of 16065 * 512 = 8225280 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\nDisk identifier: 0x00000000\r\n\r\n\r\nDisk \/dev\/xvde: 80.5 GB, 80530636800 bytes\r\n255 heads, 63 sectors\/track, 9790 cylinders\r\nUnits = cylinders of 16065 * 512 = 8225280 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\nDisk identifier: 0x00000000\r\n\r\n\r\nDisk \/dev\/xvdf: 80.5 GB, 80530636800 bytes\r\n255 heads, 63 sectors\/track, 9790 cylinders\r\nUnits = cylinders of 16065 * 512 = 8225280 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\nDisk identifier: 0x00000000\r\n\r\n\r\nDisk \/dev\/xvdg: 80.5 GB, 80530636800 bytes\r\n255 heads, 63 sectors\/track, 9790 cylinders\r\nUnits = cylinders of 16065 * 512 = 8225280 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\nDisk identifier: 0x00000000\r\n\r\n<\/pre>\n<p>Many disks are now available, we can see them by running:<\/p>\n<pre>[root@lvm-extend-test ~]# ls \/dev\/xv*\r\n\/dev\/xvda  \/dev\/xvda1  \/dev\/xvdb  \/dev\/xvdc  \/dev\/xvdc1  \/dev\/xvdd  \/dev\/xvde  \/dev\/xvdf  \/dev\/xvdg\r\n<\/pre>\n<p>Step 6: Run cfdisk and start partitioning each disk.<\/p>\n<pre>cfdisk \/dev\/xvdb\r\n\r\n<\/pre>\n<p>Create New Partition<a href=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-12.24.14-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-180\" src=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-12.24.14-PM.png\" alt=\"Screen Shot 2015-10-12 at 12.24.14 PM\" width=\"751\" height=\"93\" srcset=\"https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-12.24.14-PM.png 751w, https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-12.24.14-PM-300x37.png 300w, https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-12.24.14-PM-500x62.png 500w\" sizes=\"auto, (max-width: 751px) 100vw, 751px\" \/><\/a>of Primary Partition Type<\/p>\n<p><a href=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-12.24.23-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-181\" src=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-12.24.23-PM.png\" alt=\"Screen Shot 2015-10-12 at 12.24.23 PM\" width=\"701\" height=\"120\" srcset=\"https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-12.24.23-PM.png 701w, https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-12.24.23-PM-300x51.png 300w, https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-12.24.23-PM-500x86.png 500w\" sizes=\"auto, (max-width: 701px) 100vw, 701px\" \/><\/a>Using maximum space available<\/p>\n<p><a href=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-12.24.29-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-182\" src=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-12.24.29-PM.png\" alt=\"Screen Shot 2015-10-12 at 12.24.29 PM\" width=\"345\" height=\"65\" srcset=\"https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-12.24.29-PM.png 345w, https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-12.24.29-PM-300x57.png 300w\" sizes=\"auto, (max-width: 345px) 100vw, 345px\" \/><\/a><\/p>\n<p>Using type 8E LVM Filesystem TYPE<\/p>\n<p><a href=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-12.24.44-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-183\" src=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-12.24.44-PM.png\" alt=\"Screen Shot 2015-10-12 at 12.24.44 PM\" width=\"1176\" height=\"640\" srcset=\"https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-12.24.44-PM.png 1176w, https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-12.24.44-PM-300x163.png 300w, https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-12.24.44-PM-1024x557.png 1024w, https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-12.24.44-PM-500x272.png 500w\" sizes=\"auto, (max-width: 1176px) 100vw, 1176px\" \/><\/a><\/p>\n<p>Write partition data:<br \/>\n<a href=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-12.27.40-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-184\" src=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-12.27.40-PM.png\" alt=\"Screen Shot 2015-10-12 at 12.27.40 PM\" width=\"913\" height=\"135\" srcset=\"https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-12.27.40-PM.png 913w, https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-12.27.40-PM-300x44.png 300w, https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-12-at-12.27.40-PM-500x74.png 500w\" sizes=\"auto, (max-width: 913px) 100vw, 913px\" \/><\/a><\/p>\n<p>Step 7: Repeat this for any additional block storage disks you may have. I have a total of 5 CBS volumes, so I need to repeat this another 4 times.<\/p>\n<p>&lt;pre&gt;<\/p>\n<pre>cfdisk \/dev\/xvdc\r\ncfdisk \/dev\/xvde\r\ncfdisk \/dev\/xvdf\r\ncfdisk \/dev\/xvdg\r\n<\/pre>\n<p>Step 8: Verify that the partitions exist. (check each one has a 1 on the end now)<\/p>\n<pre>\r\n[root@lvm-extend-test ~]# ls \/dev\/xvd*\r\n\/dev\/xvda  \/dev\/xvda1  \/dev\/xvdb  \/dev\/xvdb1  \/dev\/xvdc  \/dev\/xvdc1  \/dev\/xvdd  \/dev\/xvdd1  \/dev\/xvde  \/dev\/xvde1  \/dev\/xvdf  \/dev\/xvdf1  \/dev\/xvdg  \/dev\/xvdg1\r\n<\/pre>\n<p>Step 9: Install LVM <\/p>\n<pre> yum install lvm2 <\/pre>\n<p>Step 10: Create first physical volume<\/p>\n<pre>\r\n[root@lvm-extend-test ~]# pvcreate \/dev\/xvdb1\r\n  Physical volume \"\/dev\/xvdb1\" successfully created\r\n<\/pre>\n<p>Step 11: Check Physical Volume <\/p>\n<pre> [root@lvm-extend-test ~]# pvdisplay\r\n  \"\/dev\/xvdb1\" is a new physical volume of \"75.00 GiB\"\r\n  --- NEW Physical volume ---\r\n  PV Name               \/dev\/xvdb1\r\n  VG Name\r\n  PV Size               75.00 GiB\r\n  Allocatable           NO\r\n  PE Size               0\r\n  Total PE              0\r\n  Free PE               0\r\n  Allocated PE          0\r\n  PV UUID               7Vv8Rf-hRIr-b7Cb-aaxY-baeg-zVKR-BblJij <\/pre>\n<p>Step 11: Create a volume group on the first physical volume and give it a name DataGroup00<\/p>\n<pre>\r\n[root@lvm-extend-test ~]# vgcreate DataGroup00 \/dev\/xvdb1\r\n  Volume group \"DataGroup00\" successfully created\r\n\r\n[root@lvm-extend-test ~]# vgdisplay\r\n  --- Volume group ---\r\n  VG Name               DataGroup00\r\n  System ID\r\n  Format                lvm2\r\n  Metadata Areas        1\r\n  Metadata Sequence No  1\r\n  VG Access             read\/write\r\n  VG Status             resizable\r\n  MAX LV                0\r\n  Cur LV                0\r\n  Open LV               0\r\n  Max PV                0\r\n  Cur PV                1\r\n  Act PV                1\r\n  VG Size               75.00 GiB\r\n  PE Size               4.00 MiB\r\n  Total PE              19199\r\n  Alloc PE \/ Size       0 \/ 0\r\n  Free  PE \/ Size       19199 \/ 75.00 GiB\r\n  VG UUID               Gm00iH-2a15-HO8K-Pbnj-80oh-E2Et-LE1Y2A\r\n<\/pre>\n<p>Currently the disk is 75GB. We now want to expand\/extend with LVM the size of the disk. Doing this is simple enough. <\/p>\n<p>Step 12: Extend Volume size with LVM<\/p>\n<pre>\r\n[root@lvm-extend-test ~]# vgextend DataGroup00 \/dev\/xvdd1\r\n  Physical volume \"\/dev\/xvdd1\" successfully created\r\n  Volume group \"DataGroup00\" successfully extended\r\n[root@lvm-extend-test ~]# vgdisplay\r\n  --- Volume group ---\r\n  VG Name               DataGroup00\r\n  System ID\r\n  Format                lvm2\r\n  Metadata Areas        2\r\n  Metadata Sequence No  2\r\n  VG Access             read\/write\r\n  VG Status             resizable\r\n  MAX LV                0\r\n  Cur LV                0\r\n  Open LV               0\r\n  Max PV                0\r\n  Cur PV                2\r\n  Act PV                2\r\n  VG Size               149.99 GiB\r\n  PE Size               4.00 MiB\r\n  Total PE              38398\r\n  Alloc PE \/ Size       0 \/ 0\r\n  Free  PE \/ Size       38398 \/ 149.99 GiB\r\n  VG UUID               Gm00iH-2a15-HO8K-Pbnj-80oh-E2Et-LE1Y2A\r\n\r\n<\/pre>\n<p>Now we can see we got double the space! Lets keep extending it.<\/p>\n<p>Step 13: Extend Volume size again with LVM some more.<\/p>\n<pre>[root@lvm-extend-test ~]# vgextend DataGroup00 \/dev\/xvde1\r\n  Physical volume \"\/dev\/xvde1\" successfully created\r\n  Volume group \"DataGroup00\" successfully extended\r\n[root@lvm-extend-test ~]# vgdisplay\r\n  --- Volume group ---\r\n  VG Name               DataGroup00\r\n  System ID\r\n  Format                lvm2\r\n  Metadata Areas        3\r\n  Metadata Sequence No  3\r\n  VG Access             read\/write\r\n  VG Status             resizable\r\n  MAX LV                0\r\n  Cur LV                0\r\n  Open LV               0\r\n  Max PV                0\r\n  Cur PV                3\r\n  Act PV                3\r\n  VG Size               224.99 GiB\r\n  PE Size               4.00 MiB\r\n  Total PE              57597\r\n  Alloc PE \/ Size       0 \/ 0\r\n  Free  PE \/ Size       57597 \/ 224.99 GiB\r\n  VG UUID               Gm00iH-2a15-HO8K-Pbnj-80oh-E2Et-LE1Y2A\r\n\r\n[root@lvm-extend-test ~]# vgextend DataGroup00 \/dev\/xvdf1\r\n  Physical volume \"\/dev\/xvdf1\" successfully created\r\n  Volume group \"DataGroup00\" successfully extended\r\n[root@lvm-extend-test ~]# vgdisplay\r\n  --- Volume group ---\r\n  VG Name               DataGroup00\r\n  System ID\r\n  Format                lvm2\r\n  Metadata Areas        4\r\n  Metadata Sequence No  4\r\n  VG Access             read\/write\r\n  VG Status             resizable\r\n  MAX LV                0\r\n  Cur LV                0\r\n  Open LV               0\r\n  Max PV                0\r\n  Cur PV                4\r\n  Act PV                4\r\n  VG Size               299.98 GiB\r\n  PE Size               4.00 MiB\r\n  Total PE              76796\r\n  Alloc PE \/ Size       0 \/ 0\r\n  Free  PE \/ Size       76796 \/ 299.98 GiB\r\n  VG UUID               Gm00iH-2a15-HO8K-Pbnj-80oh-E2Et-LE1Y2A\r\n\r\n[root@lvm-extend-test ~]# vgextend DataGroup00 \/dev\/xvdg1\r\n  Physical volume \"\/dev\/xvdg1\" successfully created\r\n  Volume group \"DataGroup00\" successfully extended\r\n[root@lvm-extend-test ~]# vgdisplay\r\n  --- Volume group ---\r\n  VG Name               DataGroup00\r\n  System ID\r\n  Format                lvm2\r\n  Metadata Areas        5\r\n  Metadata Sequence No  5\r\n  VG Access             read\/write\r\n  VG Status             resizable\r\n  MAX LV                0\r\n  Cur LV                0\r\n  Open LV               0\r\n  Max PV                0\r\n  Cur PV                5\r\n  Act PV                5\r\n  VG Size               374.98 GiB\r\n  PE Size               4.00 MiB\r\n  Total PE              95995\r\n  Alloc PE \/ Size       0 \/ 0\r\n  Free  PE \/ Size       95995 \/ 374.98 GiB\r\n  VG UUID               Gm00iH-2a15-HO8K-Pbnj-80oh-E2Et-LE1Y2A\r\n\r\n<\/pre>\n<p>Now we are at 374.98GB Capacity. 5 x 75GB.  No problems at all! Imagine if you were doing this with 1000GIG volumes. You could put yourself together a pretty tight CBS. The thing i&#8217;d be worried bout was data loss though. So you&#8217;d want a server identical to this, with rsync setup across the two for some level of redundancy. and you&#8217;d want it, preferably in a completely different datacentre, too.<\/p>\n<p>Last thing now. Actually creating the ext4 filesystem on this volumegroup. We&#8217;ve partitioned so that the disk can be used. We&#8217;ve created volume and group so that disks can be assigned to the OS as a disk. Now we need to format it with the filesystem. So lets take some steps to do that:<\/p>\n<p>Step 13: Create Logical Volume and Verify<\/p>\n<pre>\r\n\r\n[root@lvm-extend-test ~]# lvcreate -l +100%FREE DataGroup00 -n data\r\n  Logical volume \"data\" created.\r\n\r\n[root@lvm-extend-test ~]# lvdisplay\r\n  --- Logical volume ---\r\n  LV Path                \/dev\/DataGroup00\/data\r\n  LV Name                data\r\n  VG Name                DataGroup00\r\n  LV UUID                JGTRSg-JdNm-aumq-wJFC-VHVb-Sdm9-VVfp5c\r\n  LV Write Access        read\/write\r\n  LV Creation host, time lvm-extend-test, 2015-10-12 11:53:45 +0000\r\n  LV Status              available\r\n  # open                 0\r\n  LV Size                374.98 GiB\r\n  Current LE             95995\r\n  Segments               5\r\n  Allocation             inherit\r\n  Read ahead sectors     auto\r\n  - currently set to     256\r\n  Block device           253:0\r\n<\/pre>\n<p>Step 14: Make Volume Active<\/p>\n<pre>\r\n[root@lvm-extend-test ~]# vgscan\r\n  Reading all physical volumes.  This may take a while...\r\n  Found volume group \"DataGroup00\" using metadata type lvm2\r\n<\/pre>\n<p>Step 15: Create Filesystem on physical volume<\/p>\n<pre>\r\n[root@lvm-extend-test ~]# mkfs.ext4 \/dev\/mapper\/DataGroup00-data\r\nmke2fs 1.41.12 (17-May-2010)\r\nFilesystem label=\r\nOS type: Linux\r\nBlock size=4096 (log=2)\r\nFragment size=4096 (log=2)\r\nStride=0 blocks, Stripe width=0 blocks\r\n24576000 inodes, 98298880 blocks\r\n4914944 blocks (5.00%) reserved for the super user\r\nFirst data block=0\r\nMaximum filesystem blocks=4294967296\r\n3000 block groups\r\n32768 blocks per group, 32768 fragments per group\r\n8192 inodes per group\r\nSuperblock backups stored on blocks:\r\n\t32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,\r\n\t4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968\r\n\r\nWriting inode tables: done\r\nCreating journal (32768 blocks): done\r\nWriting superblocks and filesystem accounting information: done\r\n\r\nThis filesystem will be automatically checked every 30 mounts or\r\n180 days, whichever comes first.  Use tune2fs -c or -i to override.<\/pre>\n<p>Step 16: Making a moint point folder<\/p>\n<pre> mkdir \/lvm-data\r\n<\/pre>\n<p>Step 17: Update your fstab (TAKE CARE) so that the disk is attached to the required on boot<\/p>\n<pre>\r\n\r\n[root@lvm-extend-test ~]# vi \/etc\/fstab\r\n\r\n# Required line \r\n\/dev\/mapper\/DataGroup00-data    \/lvm-data           ext4    defaults        0 0\r\n\r\n<\/pre>\n<p>Step 18: Mount the LVM<\/p>\n<pre>\r\n[root@lvm-extend-test ~]# mount \/lvm-data\r\n[root@lvm-extend-test ~]#\r\n<\/pre>\n<p>There ya go! You have your 375GB Volume! You can extend this at any point! Just simply make a new CBS volume and then repeat the process of mounting it and then extending it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A lot of customers ask the question of how to have a data volume that can be incrementally increased in size vertically over a period of time. Here is how to setup a server like that from start to finish. &hellip; <a href=\"https:\/\/haxed.me.uk\/index.php\/2015\/10\/12\/extending-disk-sizes-with-lvm\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-171","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"_links":{"self":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/171","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/comments?post=171"}],"version-history":[{"count":6,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/171\/revisions"}],"predecessor-version":[{"id":189,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/171\/revisions\/189"}],"wp:attachment":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/media?parent=171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/categories?post=171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/tags?post=171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}