{"id":296,"date":"2019-01-26T16:58:20","date_gmt":"2019-01-26T16:58:20","guid":{"rendered":"https:\/\/unsrewiki.1sys1.com\/?p=296"},"modified":"2019-01-26T16:59:28","modified_gmt":"2019-01-26T16:59:28","slug":"increase-the-size-of-the-logical-volume","status":"publish","type":"post","link":"https:\/\/server-help.org\/index.php\/2019\/01\/26\/increase-the-size-of-the-logical-volume\/","title":{"rendered":"Increase the Size of the Logical Volume"},"content":{"rendered":"\n<p>Step 1: Access your Server via SSH<\/p>\n\n\n\n<p>Step 2: Check your current Disk Space<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># df -h\nFilesystem             Size  Used Avail Use% Mounted on\n\/dev\/md2                28G  565M   27G   3% \/\ndevtmpfs                16G     0   16G   0% \/dev\ntmpfs                   16G     0   16G   0% \/dev\/shm\ntmpfs                   16G  1.6G   15G  10% \/run\ntmpfs                   16G     0   16G   0% \/sys\/fs\/cgroup\n\/dev\/mapper\/vg00-usr   9.8G  1.9G  7.5G  20% \/usr\nnone                    16G  4.0K   16G   1% \/tmp\n\/dev\/mapper\/vg00-var   9.8G  662M  8.7G   7% \/var\n\/dev\/mapper\/vg00-home  9.8G   37M  9.3G   1% \/home\ntmpfs                  3.2G     0  3.2G   0% \/run\/user\/0<\/code><\/pre>\n\n\n\n<p>Step 3: Check the Free Disk Space:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># pvs\n  PV         VG   Fmt  Attr PSize    PFree\n  \/dev\/md4   vg00 lvm2 a--  &lt;409.88g &lt;379.88g<\/code><\/pre>\n\n\n\n<p>Here, we have 379.88 GB free space. Basically the Logical Volume assigned either to \/vg00-var , \/vg00-usr , or \/vg00-home.<\/p>\n\n\n\n<p>Step 4: We will increase \/vg00-var by 10GB using the <strong>lvextend<\/strong> command. Same steps if you would like to increase either \/vg00-usr or \/vg00-home.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># lvextend -L +10G \/dev\/mapper\/vg00-var\n  Size of logical volume vg00\/var changed from 10.00 GiB (2560 extents) to 20.00 GiB (5120 extents).\n  Logical volume vg00\/var successfully resized.<\/code><\/pre>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>Input<\/td><td> Explanation <\/td><\/tr><tr><td><strong>lvextend<\/strong> <\/td><td>The <strong>l<\/strong>ogical <strong>v<\/strong>olume <strong>e<\/strong>xtend command used to increase logical volumes <\/td><\/tr><tr><td><strong>-L +10G<\/strong> <\/td><td>Command option to increase a <strong>L<\/strong>ogical volume by <strong>10 G<\/strong>igabytes <\/td><\/tr><tr><td><strong>\/dev\/mapper\/vg00-var<\/strong> <\/td><td>The path for the logical volume to increase<\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>Step 5: We will use Command <strong>mount<\/strong>, to display the mounted file system, and we use <strong>grep<\/strong>, to specify the return value only for \/vg00-var<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># mount | grep \/vg00-var\n\/dev\/mapper\/vg00-var on \/var type ext4 (rw,noatime,quota,usrquota,data=ordered)<\/code><\/pre>\n\n\n\n<p>Note: CentOS7 uses <strong>XFS<\/strong> file system by default, and CentOS6 uses <strong>Ext4 <\/strong>file system. However, on Dedicated Server with CentOS7 Image, the default file system is <strong>Ext4<\/strong>. Unlikely with Cloud Server, where default file system is <strong>XFS<\/strong>. Therefore, it&#8217;s very important to check the mounted File System before increasing the Logical Volume.<\/p>\n\n\n\n<p>Step 6:  To increase the file system to match that of the logical volume, we will use the <strong>xfs_growfs<\/strong> command if the filesystem uses <strong>xfs <\/strong>or <strong>resize2fs<\/strong> if the filesystem is <strong>ext4<\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># resize2fs \/dev\/mapper\/vg00-var\nresize2fs 1.42.9 (28-Dec-2013)\nFilesystem at \/dev\/mapper\/vg00-var is mounted on \/var; on-line resizing required\nold_desc_blocks = 2, new_desc_blocks = 3\nThe filesystem on \/dev\/mapper\/vg00-var is now 5242880 blocks long.<\/code><\/pre>\n\n\n\n<p>Command for XFS file System:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># xfs_growfs \/dev\/mapper\/vg00-var<\/code><\/pre>\n\n\n\n<p>Please Not:  Some older operating systems will need to use the <strong>resize4fs<\/strong> command if the <strong>resize2fs<\/strong> command does not work. <\/p>\n\n\n\n<p>Step 7: use df -h Command again to verify the free space has been added to \/vg00-var<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># df -h\nFilesystem             Size  Used Avail Use% Mounted on\n\/dev\/md2                28G  565M   27G   3% \/\ndevtmpfs                16G     0   16G   0% \/dev\ntmpfs                   16G     0   16G   0% \/dev\/shm\ntmpfs                   16G  1.6G   15G  10% \/run\ntmpfs                   16G     0   16G   0% \/sys\/fs\/cgroup\n\/dev\/mapper\/vg00-usr   9.8G  1.9G  7.5G  20% \/usr\nnone                    16G  4.0K   16G   1% \/tmp\n\/dev\/mapper\/vg00-var    20G  670M   19G   4% \/var\n\/dev\/mapper\/vg00-home  9.8G   37M  9.3G   1% \/home\ntmpfs                  3.2G     0  3.2G   0% \/run\/user\/0\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Step 1: Access your Server via SSH Step 2: Check your current Disk Space Step 3: Check the Free Disk Space: Here, we have 379.88 GB free space. Basically the Logical Volume assigned either to \/vg00-var , \/vg00-usr , or \/vg00-home. Step 4: We will increase \/vg00-var by 10GB using the lvextend command. Same steps&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,7],"tags":[],"_links":{"self":[{"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/posts\/296"}],"collection":[{"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/comments?post=296"}],"version-history":[{"count":3,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/posts\/296\/revisions"}],"predecessor-version":[{"id":299,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/posts\/296\/revisions\/299"}],"wp:attachment":[{"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/media?parent=296"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/categories?post=296"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/tags?post=296"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}