{"id":25328,"date":"2021-03-26T12:53:40","date_gmt":"2021-03-26T12:53:40","guid":{"rendered":"https:\/\/guideplanet.co.uk\/?p=25328"},"modified":"2021-06-11T14:17:08","modified_gmt":"2021-06-11T14:17:08","slug":"lvm-extention-for-centos","status":"publish","type":"post","link":"https:\/\/guideplanet.webnitix.com\/index.php\/2021\/03\/26\/lvm-extention-for-centos\/","title":{"rendered":"LVM extention for CentOS"},"content":{"rendered":"\n<p><a href=\"https:\/\/guideplanet.webnitix.com\/wp-content\/uploads\/2021\/04\/LVM-extention-CentOS.pdf\" target=\"_blank\" rel=\"noreferrer noopener\"><br>View PDF<\/a><\/p>\n\n\n\n<p><strong>Issue<\/strong>: Server was upgraded, the virtual disk (sda) was expanded correctly but the free space is not allocated to the LVM.<\/p>\n\n\n\n<p>Below you have instructions for the ngcs cloud server, which was upgraded.<\/p>\n\n\n\n<p><strong>Step-by-step guide for CentOS&nbsp;<\/strong><\/p>\n\n\n\n<p>1.&nbsp;First of all add epel-release for the CentOS system.<\/p>\n\n\n\n<p>CentOS 7:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong># yum install https:\/\/dl.fedoraproject.org\/pub\/epel\/epel-release-latest-7.noarch.rpm<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>CentOS 8:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong># yum install https:\/\/dl.fedoraproject.org\/pub\/epel\/epel-release-latest-8.noarch.rpm<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>2. Install the growpart<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong># yum install cloud-utils-growpart \u2013y<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>3. Print the current partition layout with the fdisk -l<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong># fdisk -l<\/strong> <br><strong>Disk \/dev\/sda: 80 GiB, 85899345920 bytes, 167772160 sectors<br><br>Units: sectors of 1 * 512 = 512 bytes<br><br>Sector size (logical\/physical): 512 bytes \/ 512 bytes<br><br>I\/O size (minimum\/optimal): 512 bytes \/ 512 bytes<br><br>Disklabel type: dos<br><br>Disk identifier: 0x27795bc1<br><br>Device\u00a0\u00a0\u00a0\u00a0 Boot\u00a0\u00a0 Start\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 End\u00a0\u00a0 Sectors\u00a0 Size Id Type<br><br>\/dev\/sda1\u00a0 *\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2048\u00a0\u00a0 1050623\u00a0\u00a0 1048576\u00a0 512M 83 Linux<br><br>\/dev\/sda2\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a01050624 167772159 166721536 20G 8e Linux LVM<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>4. In our example, the \/dev\/sda1 is the boot partition and <strong>\/dev\/sda2 is the Linux LVM<\/strong> partition we wish to expand. Please notice that the command is asking you for the device (sda) and the partition number 2. There is a space between sda and 2 and it is not a typo.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>#&nbsp;growpart -N -v -u auto \/dev\/sda 2<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>5. This was only a dry run, to see the changes it is going to make. If you are happy with proposed changes (see the block number changing). Run the command without \u2013N option to resize the sda2 partition.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>#&nbsp;growpart -v -u auto \/dev\/sda 2<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>6. Verify the changes with fdisk -l again. Establish which partition you wish to expand, for example it could be:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\/dev\/mapper\/centos-root<\/li><li>\/dev\/mapper\/vg00-var<\/li><\/ul>\n\n\n\n<p>7. Try to resize the partition for the LVM, If this command throws some errors, you need to reboot the server.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>#&nbsp;pvresize \/dev\/sda2<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>8. Use the free space to extend the partition<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>#&nbsp;lvextend -l +100%FREE \/dev\/mapper\/centos-root<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>9. Extend the xfs filesystem:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>#&nbsp;xfs_growfs \/dev\/mapper\/centos-root<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>View PDF Issue: Server was upgraded, the virtual disk (sda) was expanded correctly but the free space is not allocated to the LVM. Below you have instructions for the ngcs cloud server, which was upgraded. Step-by-step guide for CentOS&nbsp; 1.&nbsp;First of all add epel-release for the CentOS system. CentOS 7: # yum install https:\/\/dl.fedoraproject.org\/pub\/epel\/epel-release-latest-7.noarch.rpm CentOS [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[33,31,36],"tags":[],"class_list":["post-25328","post","type-post","status-publish","format-standard","hentry","category-all","category-ionos","category-linux-guides"],"_links":{"self":[{"href":"https:\/\/guideplanet.webnitix.com\/index.php\/wp-json\/wp\/v2\/posts\/25328","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/guideplanet.webnitix.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/guideplanet.webnitix.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/guideplanet.webnitix.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/guideplanet.webnitix.com\/index.php\/wp-json\/wp\/v2\/comments?post=25328"}],"version-history":[{"count":4,"href":"https:\/\/guideplanet.webnitix.com\/index.php\/wp-json\/wp\/v2\/posts\/25328\/revisions"}],"predecessor-version":[{"id":25345,"href":"https:\/\/guideplanet.webnitix.com\/index.php\/wp-json\/wp\/v2\/posts\/25328\/revisions\/25345"}],"wp:attachment":[{"href":"https:\/\/guideplanet.webnitix.com\/index.php\/wp-json\/wp\/v2\/media?parent=25328"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/guideplanet.webnitix.com\/index.php\/wp-json\/wp\/v2\/categories?post=25328"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/guideplanet.webnitix.com\/index.php\/wp-json\/wp\/v2\/tags?post=25328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}