{"id":139,"date":"2010-04-05T21:41:32","date_gmt":"2010-04-06T01:41:32","guid":{"rendered":"http:\/\/blog.alanporter.com\/?p=139"},"modified":"2010-04-05T21:41:32","modified_gmt":"2010-04-06T01:41:32","slug":"installing-ubuntu-on-lvm","status":"publish","type":"post","link":"https:\/\/alanporter.com\/blog\/2010\/04\/05\/installing-ubuntu-on-lvm\/","title":{"rendered":"Installing Ubuntu on LVM"},"content":{"rendered":"<p>I am a big fan of LVM, the Linux <em>Logical Volume Manager<\/em>.  It allows me to create, resize and delete disk partitions very easily.  That comes in handy when you&#8217;re trying new things out.  And it also has a nice <em>snapshot<\/em> feature, which I use when I am making a backup of a partition&#8230; while it is still in use.<\/p>\n<p>If you use the Ubuntu <em>alternate install CD<\/em>, it gives you menu options for using and configuring Logical Volume Manager.  But if you&#8217;re using the normal Live installation CD, you have to do it manually.  Fortunately, this is not too hard.  Below, I will tell how I do it.<\/p>\n<ul>\n<li>Boot the Live CD and open a shell.<\/li>\n<li>Install the LVM package in the Live CD environment:\n<pre>apt-get install lvm2<\/pre>\n<\/li>\n<li>Tell LVM to look for existing volumes, and make them <em>active<\/em>:\n<pre>vgchange -ay<\/pre>\n<\/li>\n<li>You may need to mark one or more physical volumes as being LVM pv&#8217;s:\n<pre>pvcreate \/dev\/sdX1<\/pre>\n<\/li>\n<li>You may need to create a volume group:\n<pre>vgcreate vglaptop \/dev\/sdX1<\/pre>\n<\/li>\n<li>Create the volumes that you want to use:\n<pre>lvcreate vglaptop --name=ubuntu --size=10G<\/pre>\n<\/li>\n<li>Put a filesystem on the new volume:\n<pre>mkfs.ext4 \/dev\/vglaptop\/ubuntu<\/pre>\n<\/li>\n<li>Run the installer and do &#8220;manual partitioning&#8221;.<\/li>\n<li>Use the menus to match up the newly formatted filesystems with the different mount points(root, home, etc).<\/li>\n<li>When the installer finishes, tell it to &#8220;keep on testing&#8221;.  Do not reboot.<\/li>\n<li>Mount the new root filesystem:\n<pre>cd \/mnt ; mkdir u ; mount \/dev\/vglaptop\/ubuntu u<\/pre>\n<\/li>\n<li>Mount any other partitions below that:\n<pre>mount \/dev\/sda1 u\/boot ; mount \/dev\/vglaptop\/home u\/home<\/pre>\n<p> (actually, you only need the root filesystem and \/boot &#8212; you won&#8217;t need \/home and others)<\/li>\n<li>Mount the &#8220;special&#8221; filesystems:\n<pre>mount --bind \/dev u\/dev ; mount -t proc proc u\/proc<\/pre>\n<\/li>\n<li>Start up a &#8220;change root&#8221;:\n<pre>chroot u<\/pre>\n<p> A new shell will start, using the new root filesystem as its root.<\/li>\n<li>Install the LVM package inside the chroot:\n<pre>apt-get install lvm2<\/pre>\n<\/li>\n<li>Re-build the initial RAM disk:\n<pre>update-initramfs -u -k all<\/pre>\n<p> (this step may be done for you when you install LVM)<\/li>\n<li>You <strong>may<\/strong> need to update grub:\n<pre>update-grub<\/pre>\n<\/li>\n<li>Exit the chroot shell:\n<pre>exit<\/pre>\n<\/li>\n<li>Cleanly unmount everything:\n<pre>umount u\/dev ; umount u\/proc ; umount u\/home ; umount u<\/pre>\n<\/li>\n<li>Reboot:\n<pre>reboot<\/pre>\n<\/li>\n<\/ul>\n<p>And when it boots up, it will load the kernel and initramfs, and then it will mount the root filesystem, which is on your new logical volume!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am a big fan of LVM, the Linux Logical Volume Manager. It allows me to create, resize and delete disk partitions very easily. That comes in handy when you&#8217;re trying new things out. And it also has a nice snapshot feature, which I use when I am making a backup of a partition&#8230; while [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-139","post","type-post","status-publish","format-standard","hentry","category-software","count-0","even alt","author-alan","last"],"_links":{"self":[{"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/posts\/139","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/comments?post=139"}],"version-history":[{"count":0,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/posts\/139\/revisions"}],"wp:attachment":[{"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/media?parent=139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/categories?post=139"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/tags?post=139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}