{"id":1926,"date":"2021-03-08T20:06:58","date_gmt":"2021-03-08T19:06:58","guid":{"rendered":"https:\/\/robermb.com\/blog\/?p=1926"},"modified":"2021-03-08T20:06:59","modified_gmt":"2021-03-08T19:06:59","slug":"how-to-extend-root-filesystem-using-lvm-in-centos-7-rhel-7","status":"publish","type":"post","link":"https:\/\/robermb.com\/blog\/geeks\/how-to-extend-root-filesystem-using-lvm-in-centos-7-rhel-7\/","title":{"rendered":"How to extend root Filesystem using LVM in CentOS 7 \/ RHEL 7"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">Filesystem \/ is 100% full<\/h3>\n\n\n\n<p>In this example we have the <strong>root Filesystem 100%<\/strong> full, it&#8217;s possible to <strong>expand <\/strong>the <strong>capacity <\/strong>a bit : <\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/robermb.com\/blog\/wp-content\/uploads\/image-1.png\" alt=\"\" class=\"wp-image-1928\" width=\"515\" height=\"94\" srcset=\"https:\/\/robermb.com\/blog\/wp-content\/uploads\/image-1.png 767w, https:\/\/robermb.com\/blog\/wp-content\/uploads\/image-1-300x55.png 300w, https:\/\/robermb.com\/blog\/wp-content\/uploads\/image-1-200x37.png 200w\" sizes=\"(max-width: 515px) 100vw, 515px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">1. <strong>Add virtual disk to VM<\/strong> : <\/h3>\n\n\n\n<p>Follow the official documentation : <a rel=\"noreferrer noopener\" href=\"https:\/\/docs.vmware.com\/en\/VMware-vSphere\/7.0\/com.vmware.vsphere.vm_admin.doc\/GUID-F4917C61-3D24-4DB9-B347-B5722A84368C.html\" target=\"_blank\">https:\/\/docs.vmware.com\/en\/VMware-vSphere\/7.0\/com.vmware.vsphere.vm_admin.doc\/GUID-F4917C61-3D24-4DB9-B347-B5722A84368C.html<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2. Show disks :<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># lvmdiskscan<\/code><\/pre>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-1 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/robermb.com\/blog\/wp-content\/uploads\/image-2.png\" alt=\"\" class=\"wp-image-1932\" width=\"429\" height=\"112\" srcset=\"https:\/\/robermb.com\/blog\/wp-content\/uploads\/image-2.png 597w, https:\/\/robermb.com\/blog\/wp-content\/uploads\/image-2-300x79.png 300w, https:\/\/robermb.com\/blog\/wp-content\/uploads\/image-2-200x53.png 200w\" sizes=\"(max-width: 429px) 100vw, 429px\" \/><\/figure>\n\n\n\n<p>or<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># fdisk -l<\/code><\/pre>\n\n\n\n<p>The new disk is <strong>\/dev\/sdb<\/strong><\/p>\n<\/div>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3. Create primary partition<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># fdisk \/dev\/sdb<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>n\r\np\r\n1\n\rENTER\nENTER\nt\r\n8e\r\nw<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/robermb.com\/blog\/wp-content\/uploads\/image-3.png\" alt=\"\" class=\"wp-image-1933\" width=\"499\" height=\"159\" srcset=\"https:\/\/robermb.com\/blog\/wp-content\/uploads\/image-3.png 927w, https:\/\/robermb.com\/blog\/wp-content\/uploads\/image-3-300x96.png 300w, https:\/\/robermb.com\/blog\/wp-content\/uploads\/image-3-200x64.png 200w\" sizes=\"(max-width: 499px) 100vw, 499px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/robermb.com\/blog\/wp-content\/uploads\/image-4.png\" alt=\"\" class=\"wp-image-1934\" width=\"375\" height=\"108\" srcset=\"https:\/\/robermb.com\/blog\/wp-content\/uploads\/image-4.png 596w, https:\/\/robermb.com\/blog\/wp-content\/uploads\/image-4-300x87.png 300w, https:\/\/robermb.com\/blog\/wp-content\/uploads\/image-4-200x58.png 200w\" sizes=\"(max-width: 375px) 100vw, 375px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4. Show Filesystems types :<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># df -T<\/code><\/pre>\n\n\n\n<p>In the example the Filesystems are <strong>xfs<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/robermb.com\/blog\/wp-content\/uploads\/image-5.png\" alt=\"\" class=\"wp-image-1936\" width=\"302\" height=\"119\" srcset=\"https:\/\/robermb.com\/blog\/wp-content\/uploads\/image-5.png 416w, https:\/\/robermb.com\/blog\/wp-content\/uploads\/image-5-300x118.png 300w, https:\/\/robermb.com\/blog\/wp-content\/uploads\/image-5-200x79.png 200w\" sizes=\"(max-width: 302px) 100vw, 302px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>5. Format partition :<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># mkfs.xfs \/dev\/sdb1<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>6. Create physical volume<\/strong> :<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># pvcreate \/dev\/sdb1<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>7. Extend volume group &#8220;cl&#8221; :<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># vgextend cl \/dev\/sdb1<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>8. Extend logical volume &#8220;root&#8221; :<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># lvextend -l +100%FREE \/dev\/cl\/root<\/code><\/pre>\n\n\n\n<p><span style=\"text-decoration: underline;\">Volume Group<\/span> :    cl<br><span style=\"text-decoration: underline;\">Logical Volume<\/span> :   root<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>9. Extend root Filesystem : <\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># xfs_growfs \/dev\/cl\/root<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/robermb.com\/blog\/wp-content\/uploads\/image-6.png\" alt=\"\" class=\"wp-image-1937\" width=\"452\" height=\"53\" srcset=\"https:\/\/robermb.com\/blog\/wp-content\/uploads\/image-6.png 646w, https:\/\/robermb.com\/blog\/wp-content\/uploads\/image-6-300x35.png 300w, https:\/\/robermb.com\/blog\/wp-content\/uploads\/image-6-200x24.png 200w\" sizes=\"(max-width: 452px) 100vw, 452px\" \/><\/figure>\n\n\n\n<p><span style=\"text-decoration: underline;\">Note<\/span>: For <strong>ext4 <\/strong>Filesystems use:   # resize2fs \/dev\/cl\/root<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Filesystem \/ is 100% full In this example we have the root Filesystem 100% full, it&#8217;s possible to expand the &hellip; <a href=\"https:\/\/robermb.com\/blog\/geeks\/how-to-extend-root-filesystem-using-lvm-in-centos-7-rhel-7\/\" class=\"more-link\">More <span class=\"screen-reader-text\">How to extend root Filesystem using LVM in CentOS 7 \/ RHEL 7<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":1856,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,8],"tags":[123,35,48,49],"_links":{"self":[{"href":"https:\/\/robermb.com\/blog\/wp-json\/wp\/v2\/posts\/1926"}],"collection":[{"href":"https:\/\/robermb.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/robermb.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/robermb.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/robermb.com\/blog\/wp-json\/wp\/v2\/comments?post=1926"}],"version-history":[{"count":9,"href":"https:\/\/robermb.com\/blog\/wp-json\/wp\/v2\/posts\/1926\/revisions"}],"predecessor-version":[{"id":1943,"href":"https:\/\/robermb.com\/blog\/wp-json\/wp\/v2\/posts\/1926\/revisions\/1943"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/robermb.com\/blog\/wp-json\/wp\/v2\/media\/1856"}],"wp:attachment":[{"href":"https:\/\/robermb.com\/blog\/wp-json\/wp\/v2\/media?parent=1926"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/robermb.com\/blog\/wp-json\/wp\/v2\/categories?post=1926"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/robermb.com\/blog\/wp-json\/wp\/v2\/tags?post=1926"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}