{"id":4730,"date":"2015-05-09T22:29:33","date_gmt":"2015-05-09T14:29:33","guid":{"rendered":"http:\/\/rmohan.com\/?p=4730"},"modified":"2015-05-09T22:35:10","modified_gmt":"2015-05-09T14:35:10","slug":"increase-root-partition-size-lvm-centos","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=4730","title":{"rendered":"Increase Root Partition Size \u2013 LVM \u2013 CentOS  7 , Fedora, RHEL 7"},"content":{"rendered":"<p><strong>Increase Root Partition Size \u2013 LVM \u2013 CentOS<\/strong><br \/>\nLinux root partition is different from all other partitions on your system since it holds all of the system files required for your system to run and operate.<\/p>\n<p>This is the reason why you can not increase root partition size as simply as any other partition \u2013 you can not just un-mount it because the system will not let you since it is using it.<\/p>\n<p>To increase root partition size, we have to boot off a bootable live CD\/DVD or USB image and increase root partition size from there and this requires SYSTEM DOWNTIME! It is not possible to increase root partition size without system downtime!<\/p>\n<p>For this how to i have set up a virtual linux system and filled up it\u2019s root partition, as you can see in the picture below. I will use CentOS ISO to boot a live system which will enable me to increase root partition size.<\/p>\n<p>Let\u2019s learn how to Increase Root Partition Size!<\/p>\n<p>1. Prepare Your CentOS 7 Live CD\/DVD or USB Image<\/p>\n<p>Make sure you have a live CD\/DVD or USB image to boot off from. In this how to i will use CentOS 7 DVD ISO image, but in the end you can do the same with Fedora, Ubuntu or any other live CD\/DVD ISO image.<\/p>\n<p>2. Identify Your Root Partition<\/p>\n<p>Make sure you will be able to identify the root partition when in live system. Since we are increasing a LVM root partition this should be a no brainer else, the easiest way would be remembering it\u2019s size. If you have many partitions the same size you could check the start and end blocks.<\/p>\n<p>Using LVM i identified my root partition as \/dev\/mapper\/centos-root LVM partition (centos\/root) which means it is in a VG (Volume Group) called \u201ccentos\u201d and a LV (Logical Volume) called \u201croot\u201d. Read more about managing LVM\u2019s HERE.<\/p>\n<p>After this, the CentOS 7 menu should appear.<\/p>\n<p>Choose \u201cTroubleshooting\u201d<\/p>\n<p>When your CentOS 7 ISO boots choose \u201cTroubleshooting\u201d option from the first menu.<\/p>\n<p>&nbsp;<\/p>\n<h2>Add Additional Disk<\/h2>\n<p>Add additional disk to your system so we can increase root partition size or make sure you have free space available on your\u00a0existing disk configuration. Since i am using virtual system i added\u00a0an additional 20GB disk to it which is recognized as \/dev\/sdb in my system<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h2>Choose \u201cTroubleshooting\u201d<\/h2>\n<p>When your CentOS 7 ISO boots choose \u201cTroubleshooting\u201d option from the first menu.<\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-001.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4731\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-001.jpg\" alt=\"rootfile 001\" width=\"1063\" height=\"661\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-001.jpg 1063w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-001-300x187.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-001-1024x637.jpg 1024w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-001-150x93.jpg 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-001-400x249.jpg 400w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-001-900x560.jpg 900w\" sizes=\"(max-width: 1063px) 100vw, 1063px\" \/><\/a> <a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-002.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4732\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-002.jpg\" alt=\"rootfile 002\" width=\"1063\" height=\"665\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-002.jpg 1063w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-002-300x188.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-002-1024x641.jpg 1024w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-002-150x94.jpg 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-002-400x250.jpg 400w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-002-900x563.jpg 900w\" sizes=\"(max-width: 1063px) 100vw, 1063px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h2>Choose \u201cRescue a CentOS system\u201d<\/h2>\n<p>In the second menu choose\u00a0\u201cRescue a CentOS\u00a0System\u201d.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-003.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4733\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-003.jpg\" alt=\"rootfile 003\" width=\"965\" height=\"609\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-003.jpg 965w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-003-300x189.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-003-150x95.jpg 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-003-400x252.jpg 400w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-003-900x568.jpg 900w\" sizes=\"(max-width: 965px) 100vw, 965px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h2>Skip Mounting Existing Linux Installations<\/h2>\n<p>When asked to find and mount any existing linux installations choose \u201cSkip\u201d. Since we are increasing our root partition, this partition must not be mounted.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-004.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4734\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-004.jpg\" alt=\"rootfile 004\" width=\"849\" height=\"617\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-004.jpg 849w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-004-300x218.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-004-150x109.jpg 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-004-400x291.jpg 400w\" sizes=\"(max-width: 849px) 100vw, 849px\" \/><\/a> <a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-005.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4735\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-005.jpg\" alt=\"rootfile 005\" width=\"804\" height=\"590\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-005.jpg 804w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-005-300x220.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-005-150x110.jpg 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-005-400x294.jpg 400w\" sizes=\"(max-width: 804px) 100vw, 804px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>When hiting \u201cEnter\u201d you will drop to bash shell.<\/p>\n<h2>\u00a0Prepare New Disk<\/h2>\n<p>Since i added a completely new 2GB disk to my virtual system i must prepare this disk for use with LVM. Read more about managing LVM\u2019s\u00a0<a title=\"LVM \u2013 Physical Volume Management on CentOS 6\" href=\"http:\/\/geekpeek.net\/lvm-physical-volume-management\/\" target=\"_blank\">HERE<\/a>. If you are extending your root partition with existing empty partition the process is similar just use the partition identifier (sdaX or sdbX) when running commands.<\/p>\n<p>Checking current disk configuration with \u201cfdisk -l\u201d.<\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-006.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4736\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-006.jpg\" alt=\"rootfile 006\" width=\"523\" height=\"82\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-006.jpg 523w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-006-300x47.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-006-150x24.jpg 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-006-400x63.jpg 400w\" sizes=\"(max-width: 523px) 100vw, 523px\" \/><\/a> <a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-007.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4737\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-007.jpg\" alt=\"rootfile 007\" width=\"619\" height=\"78\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-007.jpg 619w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-007-300x38.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-007-150x19.jpg 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-007-400x50.jpg 400w\" sizes=\"(max-width: 619px) 100vw, 619px\" \/><\/a> <a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-008.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4738\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-008.jpg\" alt=\"rootfile 008\" width=\"713\" height=\"222\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-008.jpg 713w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-008-300x93.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-008-150x47.jpg 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-008-400x125.jpg 400w\" sizes=\"(max-width: 713px) 100vw, 713px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>e must prepare new additional disk by\u00a0creating a new PV (Physical Volume) and extend our VG (Volume Group) as shown in the picture below \u2013 identified in Step 2 and with fdisk, VG to extend is called \u201ccentos\u201d. <a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-009.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4739\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-009.jpg\" alt=\"rootfile 009\" width=\"836\" height=\"529\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-009.jpg 836w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-009-300x190.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-009-150x95.jpg 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-009-400x253.jpg 400w\" sizes=\"(max-width: 836px) 100vw, 836px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-010.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4740\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-010.jpg\" alt=\"rootfile 010\" width=\"539\" height=\"100\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-010.jpg 539w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-010-300x56.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-010-150x28.jpg 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-010-400x74.jpg 400w\" sizes=\"(max-width: 539px) 100vw, 539px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-011.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4741\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-011.jpg\" alt=\"rootfile 011\" width=\"547\" height=\"134\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-011.jpg 547w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-011-300x73.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-011-150x37.jpg 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-011-400x98.jpg 400w\" sizes=\"(max-width: 547px) 100vw, 547px\" \/><\/a><\/p>\n<h2><span class=\"Apple-converted-space\">\u00a0<\/span>Increase Root Partition Size<\/h2>\n<p>To wrap things up we need to extend root LV with \u201clvextend\u201d command. In my case i am extending it by 511 PE (as much as there are free) and i am also using the parameter \u201c-r\u201d at the end of my command which automatically resizes the filesystem too!<\/p>\n<p>The command sytnax i used is \u201c# lvextend -l +100%FREE centos\/root -r\u201d. DO NOT FORGET the \u201c+\u201d sign before PE number! If you do, you might loose data!<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-014.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4744\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-014.jpg\" alt=\"rootfile 014\" width=\"733\" height=\"334\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-014.jpg 733w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-014-300x137.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-014-150x68.jpg 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-014-400x182.jpg 400w\" sizes=\"(max-width: 733px) 100vw, 733px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h2>Reboot the System<\/h2>\n<p>It is time to remove live image from CD\/DVD or USB and reboot to boot our existing system. After that we can check the root partition free disk space<\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-015.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4745\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/05\/rootfile-015.jpg\" alt=\"rootfile 015\" width=\"654\" height=\"281\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-015.jpg 654w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-015-300x129.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-015-150x64.jpg 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/05\/rootfile-015-400x172.jpg 400w\" sizes=\"(max-width: 654px) 100vw, 654px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Increase Root Partition Size \u2013 LVM \u2013 CentOS Linux root partition is different from all other partitions on your system since it holds all of the system files required for your system to run and operate.<\/p>\n<p>This is the reason why you can not increase root partition size as simply as any other partition \u2013 [&#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\/4730"}],"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=4730"}],"version-history":[{"count":5,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4730\/revisions"}],"predecessor-version":[{"id":4750,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4730\/revisions\/4750"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4730"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4730"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4730"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}