{"id":52,"date":"2023-03-19T07:59:16","date_gmt":"2023-03-19T06:59:16","guid":{"rendered":"http:\/\/10.4.44.99:10084\/?p=52"},"modified":"2023-03-19T07:59:16","modified_gmt":"2023-03-19T06:59:16","slug":"centos-67-decrease-a-lvm-partition","status":"publish","type":"post","link":"https:\/\/www.winni.at\/wordpress\/?p=52","title":{"rendered":"Centos | Decrease a LVM partition"},"content":{"rendered":"\n<p><strong>Shrinking a root volume | Step 1:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vgchange -a y\n<\/code><\/pre>\n\n\n\n<p><strong>Shrinking a non-root volume | Step 1:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>umount \/dev\/centos\/var\n<\/code><\/pre>\n\n\n\n<p><strong>All following steps now apply to both a root or non-root volume.<\/strong><\/p>\n\n\n\n<p><strong>Check file system:&nbsp;<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>e2fsck -fy \/dev\/centos\/var<\/code><\/pre>\n\n\n\n<p><strong>Resize file system:<\/strong><\/p>\n\n\n\n<p>The follwing command will shrink the file system so that it is only 4G in size in total!!<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>resize2fs \/dev\/centos\/var 4G\n<\/code><\/pre>\n\n\n\n<p><strong>Reduce Logical Volume:<\/strong><\/p>\n\n\n\n<p>To reduce&nbsp;<strong>to 5G<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>lvreduce -L 5G \/dev\/vg\/disk-name\n<\/code><\/pre>\n\n\n\n<p>To reduce&nbsp;<strong>by 5G<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>lvreduce -L -5G \/dev\/vg\/disk-name\n<\/code><\/pre>\n\n\n\n<p><strong>Resize file system (again):<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>resize2fs \/dev\/centos\/var\n<\/code><\/pre>\n\n\n\n<p><strong>Now just mount the file system and thats it.<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mount \/dev\/centos\/var \/mnt<\/code><\/pre>\n\n\n\n<p>Source:&nbsp;<a href=\"https:\/\/www.rootusers.com\/lvm-resize-how-to-decrease-an-lvm-partition\/\">https:\/\/www.rootusers.com\/lvm-resize-how-to-decrease-an-lvm-partition\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Shrinking a root volume | Step 1: Shrinking a non-root volume | Step 1: All following steps now apply to<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[3],"tags":[117,119,128,130,131],"class_list":["post-52","post","type-post","status-publish","format-standard","hentry","category-kb","tag-linux","tag-linux-lvm","tag-lvm","tag-lvm-decrease","tag-lvm-decrease-partition"],"_links":{"self":[{"href":"https:\/\/www.winni.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/52","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.winni.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.winni.at\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.winni.at\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.winni.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=52"}],"version-history":[{"count":0,"href":"https:\/\/www.winni.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/52\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.winni.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=52"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.winni.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=52"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.winni.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=52"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}