{"id":6113,"date":"2016-07-31T16:29:42","date_gmt":"2016-07-31T08:29:42","guid":{"rendered":"http:\/\/rmohan.com\/?p=6113"},"modified":"2016-07-31T16:29:42","modified_gmt":"2016-07-31T08:29:42","slug":"dding-disk-space-to-an-existing-volume-group","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6113","title":{"rendered":"DDING DISK SPACE TO AN EXISTING VOLUME GROUP"},"content":{"rendered":"<p>In the situation where you have exhausted all of the disk space in a volume group, you can add additional disks to the volume group in order to remediate the situation.<\/p>\n<p>Locate the additional disk using the fdisk -l command.<\/p>\n<p>[root@slave ~]# fdisk -l<br \/>\nDisk \/dev\/sdd: 3221 MB, 3221225472 bytes, 6291456 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 \/>\nThe next step is to create a LVM partition using the above disk (\/dev\/sdd).<\/p>\n<p>[root@slave ~]# fdisk \/dev\/sdd<br \/>\nType in n and press enter three times.<br \/>\nType in +2G and press enter.<br \/>\nType in t and press enter.<br \/>\nType in 8e and press enter.<br \/>\nType in w and press enter.<br \/>\nType in q and press enter.<br \/>\nRun partprobe to make the kernel aware of the disk changes.<\/p>\n<p>[root@slave ~]# partprobe<br \/>\nCheck the partition path by running fdisk -l.<\/p>\n<p>[root@slave ~]# fdisk -l<br \/>\nDisk \/dev\/sdd: 3221 MB, 3221225472 bytes, 6291456 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: 0xeef01ba1<br \/>\n   Device Boot      Start         End      Blocks   Id  System<br \/>\n\/dev\/sdd1            2048     4196351     2097152   8e  Linux LVM<br \/>\nCreate the physical volume using pvcreate.<\/p>\n<p>[root@slave ~]# pvcreate \/dev\/sdd1<br \/>\n  Physical volume &#8220;\/dev\/sdd1&#8221; successfully created<br \/>\nWe\u2019re now going to add 2GB of space from the new \/dev\/sdd1 partition to the lvtestvolume volume group.<\/p>\n<p>[root@slave ~]# vgextend lvtestvolume \/dev\/sdd1<br \/>\n  Volume group &#8220;lvtestvolume&#8221; successfully extended<br \/>\nVerify the size of the volume group by running vgdisplay lvtestvolume.<\/p>\n<p>[root@slave ~]# vgdisplay lvtestvolume<br \/>\n  &#8212; Volume group &#8212;<br \/>\n  VG Name               lvtestvolume<br \/>\n  System ID<br \/>\n  Format                lvm2<br \/>\n  Metadata Areas        2<br \/>\n  Metadata Sequence No  3<br \/>\n  VG Access             read\/write<br \/>\n  VG Status             resizable<br \/>\n  MAX LV                0<br \/>\n  Cur LV                1<br \/>\n  Open LV               1<br \/>\n  Max PV                0<br \/>\n  Cur PV                2<br \/>\n  Act PV                2<br \/>\n  VG Size               4.99 GiB<br \/>\n  PE Size               4.00 MiB<br \/>\n  Total PE              1278<br \/>\n  Alloc PE \/ Size       512 \/ 2.00 GiB<br \/>\n  Free  PE \/ Size       766 \/ 2.99 GiB<br \/>\n  VG UUID               wxeQ0N-ZboT-lN2s-CCeQ-zkbb-B24Q-Khh6NB<br \/>\nThe disk space has now been made available to the volume group, however the logical volume needs to be extended in order to make use of the additional space.<\/p>\n<p>[root@slave ~]# lvdisplay lvtestvolume<br \/>\n  &#8212; Logical volume &#8212;<br \/>\n  LV Path                \/dev\/lvtestvolume\/data<br \/>\n  LV Name                data<br \/>\n  VG Name                lvtestvolume<br \/>\n  LV UUID                fwCnof-OoOu-8PNR-wPC2-LqBL-TQK6-DCZbiR<br \/>\n  LV Write Access        read\/write<br \/>\n  LV Creation host, time slave, 2014-10-13 19:23:50 -0400<br \/>\n  LV Status              available<br \/>\n  # open                 1<br \/>\n  LV Size                2.00 GiB<br \/>\n  Current LE             512<br \/>\n  Segments               1<br \/>\n  Allocation             inherit<br \/>\n  Read ahead sectors     auto<br \/>\n  &#8211; currently set to     8192<br \/>\n  Block device           253:4<br \/>\nWe can now use lvextend to add an additional 2GB of space to the lvtestvolume.<\/p>\n<p>[root@slave ~]# lvextend -L +2G \/dev\/lvtestvolume\/data<br \/>\n  Extending logical volume data to 4.00 GiB<br \/>\n  Logical volume data successfully resized<br \/>\nWe can finally verify the disk space addition from using lvdisplay \/dev\/lvtestvolume\/data or through using df -hk | grep \/data.<\/p>\n<p>[root@slave ~]# lvdisplay \/dev\/lvtestvolume\/data<br \/>\n  &#8212; Logical volume &#8212;<br \/>\n  LV Path                \/dev\/lvtestvolume\/data<br \/>\n  LV Name                data<br \/>\n  VG Name                lvtestvolume<br \/>\n  LV UUID                fwCnof-OoOu-8PNR-wPC2-LqBL-TQK6-DCZbiR<br \/>\n  LV Write Access        read\/write<br \/>\n  LV Creation host, time slave, 2014-10-13 19:23:50 -0400<br \/>\n  LV Status              available<br \/>\n  # open                 1<br \/>\n  LV Size                4.00 GiB<br \/>\n  Current LE             1024<br \/>\n  Segments               2<br \/>\n  Allocation             inherit<br \/>\n  Read ahead sectors     auto<br \/>\n  &#8211; currently set to     8192<br \/>\n  Block device           253:4<br \/>\n[root@slave ~]# df -hk | grep \/data<br \/>\n\/dev\/mapper\/lvtestvolume-data   1998672   6144   1871288   1% \/data<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the situation where you have exhausted all of the disk space in a volume group, you can add additional disks to the volume group in order to remediate the situation.<\/p>\n<p>Locate the additional disk using the fdisk -l command.<\/p>\n<p>[root@slave ~]# fdisk -l Disk \/dev\/sdd: 3221 MB, 3221225472 bytes, 6291456 sectors Units = sectors [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6113"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6113"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6113\/revisions"}],"predecessor-version":[{"id":6114,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6113\/revisions\/6114"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6113"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}