I recently bought a new 1TeraByte hard disk, and tried to understand the possible ways to add it to my existing Ubuntu Linux system. On a default system, even with separate home and root partitions, it is quite difficult to exploit the added space of a new drive: one could migrate the home partition to the new drive and expand the root partition to cover the whole old drive, but it is not a flexible nor scalable solution. On a Linux system with Logical Volume Management (LVM) instead, all I should do is add the new drive into the volume group to have the possibility to expand both partitions. LVM is a system that stays between the filesystems and the physical drives, and simplifies the management of separate physical volumes by adding abstraction layers (Volume Groups and Logical Volumes). All the information you might need on LVM can be found here: http://tldp.org/HOWTO/html_single/LVM-HOWTO/
One problem with LVM is that in order to resize the root partition, the root partition must be unmounted. The easiest way is to boot a Live CD and manage the partitions from there. The Ubuntu Live CD does not support LVM: in order to install an Ubuntu system with LVM, the alternate installer CD must be used. This CD lacks the live graphical environment of the default Ubuntu desktop CD, and instead offers a text-based installer; the alternate CD lacks also an easy way to manage partition without reinstalling. What I need is a CD that enables both LVM installation and LVM managing, and this tutorial will show how to create it.
There is a very handy and complete guide here to customize Ubuntu Live CD:
In order to build the CD I used a VirtualBox virtual machine, but it is not necessary: you just need an Ubuntu machine and administration privileges. The hard disk occupation of the whole process, including the ISO images of the original Live CD and the custom Live CD, is around 3.5GB, so organize your hard disk space accordingly. I downloaded an Ubuntu Jaunty Jackalope desktop CD iso from the official site, and I followed the guide literally for the sections:
Then, for the Customizations section, I uninstalled some secondary packages to free space for “lvm2” package and then I installed it:
# apt-get purge gimp gimp-data
# apt-get purge gnome-games gnome-games-data
# apt-get install lvm2
I then wanted to install the graphical and user-friendly tool “system-config-lvm” package; the package is included under the “universe” section that is disabled by default. For this reason I opened the configuration file of the “apt” repositories with the command “nano /etc/apt/sources.list”, uncommented the deb lines of the “universe” section and saved. To have a glimpse of the functionalities of this GUI front-end for LVM you can take a look at the relative section in the redhat enterprise manual.
# apt-get update
# apt-get install system-config-lvm
# apt-get autoremove
# apt-get clean
# apt-get autoclean
I then recreate the filesystem image. Since I used Ubuntu Jaunty Jackalope, the kernel release version is 2.6.28-11-generic. You can discover your release using “ls /lib/modules”, because the name of that directory corresponds to the kernel version of the original Live CD;
change the following “mkinitramfs” command accordingly.
# mkinitramfs -o /initrd.gz 2.6.28-11-generic
Some commands to cleanup the Live CD…
# rm -rf /tmp/* ~/.bash_history
# rm /etc/resolv.conf
# proc ">umount /proc || umount -lf /proc
# umount /sys
# umount /dev/pts
Then, in the normal command prompt, I moved the filesystem image (initrd.gz) into the casper directory like the tutorial says:
$ sudo umount edit/dev || sudo umount -lf edit/dev
$ sudo mv edit/initrd.gz extract-cd/casper/
I then followed literally the “Putting the CD together” section, and at the end I had an iso image of a complete Ubuntu Live CD with LVM support.
I hope to find the time to do a screencast on how to install Ubuntu with this custom CD and how to modify an already installed LVM system.