{"id":62,"date":"2008-10-07T20:07:49","date_gmt":"2008-10-07T20:07:49","guid":{"rendered":"http:\/\/www.piglets.org\/?p=62"},"modified":"2015-10-06T14:14:26","modified_gmt":"2015-10-06T14:14:26","slug":"guided-lvm-in-debian","status":"publish","type":"post","link":"https:\/\/www.piglets.org\/blog\/2008\/10\/07\/guided-lvm-in-debian\/","title":{"rendered":"Guided LVM in Debian"},"content":{"rendered":"<p>I recently reinstalled one of the boxes here, Lorien, from scratch. It was a brand new SATA disk and I used the Debian Lenny beta 2 installer. I'd never tried LVM before, I'd always used \"normal\" partitioning, but for some reason I figured I'd give this a shot. It all worked ok, but it left one problem. The amount of space Debian allocated to the root partition was pitifully small (less than 300 megabytes), and I hit a snag when a kernel upgrade came through, and wanted to install lots of stuff in that partition. So, first of all a warning, the guided partitioning is, and always has been in my opinion, not too optimal in the way it picks spaces for partitions. Secondly, here is how I fixed it, which is a slight pain since you can't have the root partition mounted.<\/p>\n<p>Since I was going to have to resize my root partition, I used my Debian install CD again, but this time in <em>rescue<\/em> mode (just type rescue at the prompt).<\/p>\n<p>Then you can get a terminal up. I had inadvertently mounted my root partition as \/target, so I began by unmounting it.<\/p>\n<pre lang=Shell>\r\numount \/target\r\n<\/pre>\n<p>Next we need to reduce a partition. I chose to resize my home partition, original 200G to 199G, since I reckoned an extra gigabyte would be more than enough on the root partition.<\/p>\n<pre lang=Shell>\r\n# Check the filesystem\r\ne2fsck -f \/dev\/lorien\/home\r\n# Make it slightly smaller\r\nresize2fs \/dev\/lorien\/home 199G\r\n# We are about to play with LVM\r\nlvchange -a n \/dev\/lorien\/home\r\n# Tell it to reduce the size by 1 Gigabyte\r\nlvreduce -L-1g \/dev\/lorien\/home\r\n# Done with LVM\r\nlvchange -a y \/dev\/lorien\/home\r\n# Check the filesystem again\r\ne2fsck -f \/dev\/lorien\/home\r\n<\/pre>\n<p>Finally, increase the size of the root partition.<\/p>\n<pre lang=Shell>\r\n# Playing with LVM\r\nlvchange -a n \/dev\/lorien\/root\r\n# Increase the LV by 1 G\r\nlvextend -L+1g \/dev\/lorien\/root\r\n# Finished with LVM\r\nlvchange -a y \/dev\/lorien\/root\r\n# Check the file system\r\ne2fsck -f \/dev\/lorien\/root\r\n# resize it\r\nresize2fs \/dev\/lorien\/root\r\n# Check one last time.\r\ne2fsk -f \/dev\/lorien\/root\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I recently reinstalled one of the boxes here, Lorien, from scratch. It was a brand new SATA disk and I used the Debian Lenny beta 2 installer. I'd never tried LVM before, I'd always used \"normal\" partitioning, but for some reason I figured I'd give this a shot. It all worked ok, but it left [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"vkexunit_cta_each_option":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[7],"tags":[16],"class_list":["post-62","post","type-post","status-publish","format-standard","hentry","category-11-free-software","tag-free-software"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"jetpack_shortlink":"https:\/\/wp.me\/p52I4w-10","_links":{"self":[{"href":"https:\/\/www.piglets.org\/blog\/wp-json\/wp\/v2\/posts\/62","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.piglets.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.piglets.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.piglets.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.piglets.org\/blog\/wp-json\/wp\/v2\/comments?post=62"}],"version-history":[{"count":1,"href":"https:\/\/www.piglets.org\/blog\/wp-json\/wp\/v2\/posts\/62\/revisions"}],"predecessor-version":[{"id":362,"href":"https:\/\/www.piglets.org\/blog\/wp-json\/wp\/v2\/posts\/62\/revisions\/362"}],"wp:attachment":[{"href":"https:\/\/www.piglets.org\/blog\/wp-json\/wp\/v2\/media?parent=62"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.piglets.org\/blog\/wp-json\/wp\/v2\/categories?post=62"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.piglets.org\/blog\/wp-json\/wp\/v2\/tags?post=62"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}