{"id":47,"date":"2010-09-15T18:29:04","date_gmt":"2010-09-15T16:29:04","guid":{"rendered":"https:\/\/thebc.ch\/blog\/?p=47"},"modified":"2013-02-01T13:18:27","modified_gmt":"2013-02-01T12:18:27","slug":"shrink-lvm-partition","status":"publish","type":"post","link":"https:\/\/thebc.ch\/blog\/?p=47","title":{"rendered":"Shrink LVM partition"},"content":{"rendered":"<span id=\"Some_Warnings\"><h2>Some Warnings<\/h2><\/span>\n<p>Since I&#8217;m a quiet crazy guy I worked this guide out without a backup of my data.<br \/>\n<strong>!!! DONT&#8217;T BE SO STUPID LIKE ME !!!<\/strong><br \/>\nAnyway everything went smooth. But don&#8217;t cry if you are trashing all your data!<\/p>\n<span id=\"The_initial_position\"><h2>The initial position<\/h2><\/span>\n<p>I have the following disk:<\/p>\n<pre lang=\"text\">Disk \/dev\/sda: 100.0 GB, 100030242816 bytes\r\n255 heads, 63 sectors\/track, 12161 cylinders\r\nUnits = cylinders of 16065 * 512 = 8225280 bytes\r\n\r\n   Device Boot      Start         End      Blocks   Id  System\r\n\/dev\/sda1               1          26      204819+  ee  EFI GPT\r\n\/dev\/sda2              26         662     5111808   af  Unknown\r\n\/dev\/sda3   *         662         675      102400   83  Linux\r\n\/dev\/sda4             675       12161    92264204+  8e  Linux LVM<\/pre>\n<span id=\"What_I_like_to_archive\"><h2>What I like to archive<\/h2><\/span>\n<span id=\"Do_the_resize\"><h2>Do the resize<\/h2><\/span>\n<pre lang=\"bash\">lvm vgchange -a y\r\ne2fsck -f \/dev\/VolGroup00\/LogVol00\r\nresize2fs -f \/dev\/VolGroup00\/LogVol00 10G\r\ne2fsck -f \/dev\/VolGroup00\/LogVol00<\/pre>\n<p>Now display the the Logical Volume (it is still 86.00 GB) lets reduce it also to 40G<\/p>\n<pre lang=\"bash\">lvm lvdisplay \/dev\/VolGroup00\/LogVol00\r\nlvm lvreduce -L10G \/dev\/VolGroup00\/LogVol00\r\nlvm lvdisplay \/dev\/VolGroup00\/LogVol00<\/pre>\n<p>Now it is 40.00 GB<\/p>\n<span id=\"Try_to_mount_the_volume\"><h2>Try to mount the volume<\/h2><\/span>\n<pre lang=\"bash\">mount \/dev\/VolGroup00\/LogVol00 \/mnt\/source\r\numount \/mnt\/source<\/pre>\n<p>lvm lvdisplay<\/p>\n<p>as you can see we have now two logical volumes (LogVol00 40.00 GB and LogVol01 1.94GB)<\/p>\n<pre lang=\"bash\">lvm vgdisplay<\/pre>\n<p>we have free PE 46.03 GB and allocated PE 41.94 GB<\/p>\n<p>First find the LVM-Partition with<\/p>\n<pre lang=\"bash\">fdisk \/dev\/sda<\/pre>\n<p><strong>Note:<\/strong> our partition is sda4<\/p>\n<pre lang=\"bash\">lvm pvresize --setphysicalvolumesize 41.94G \/dev\/sda4<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Since LVM-Partitions could not be resized with tools like gparted or qtparted I wrote this little guide. Hope you enjoy it \ud83d\ude42  <a href=\"https:\/\/thebc.ch\/blog\/?p=47\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,6],"tags":[],"class_list":["post-47","post","type-post","status-publish","format-standard","hentry","category-linux","category-lvm"],"_links":{"self":[{"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts\/47","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=47"}],"version-history":[{"count":9,"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts\/47\/revisions"}],"predecessor-version":[{"id":2748,"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts\/47\/revisions\/2748"}],"wp:attachment":[{"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=47"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=47"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=47"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}