Installing Ubuntu 8.04 on LVM2
[ Wednesday, 7 May 2008, MAcks ]
Ubuntu 8.04 in desktop edition does not handle installation on LVM2 partitions. In this article we are going to show how to achieve this with just a little bit of command line hacking.
LVM is a logical volume manager for Linux which features a few important benefits compared to standard BIOS partitions (after Wikipedia):
- Resize volume groups online by absorbing new physical volumes (PV) or ejecting existing ones.
- Resize logical volumes online by concatenating extents onto them or truncating extents from them.
- Create read-only snapshots of logical volumes (LVM1).
- Create read-write snapshots of logical volumes (LVM2).
- Stripe whole or parts of logical volumes across multiple PVs, in a fashion similar to RAID0.
- Mirror whole or parts of logical volumes, in a fashion similar to RAID1.
- Move online logical volumes between PVs.
- Split or merge volume groups in situ (as long as no logical volumes span the split). This can be useful when migrating whole logical volumes to or from offline storage.
The article assumes that you have some basic knowledge of GNU/Linux, are not afraid of using command line and you have already created a volume group called lvUBUNTU. More information about LVM for ambitious beginners can be found in a comprehensive LVM HOWTO.
Let’s assume the following configuration:
- /boot (primary BIOS partition, about 500-600 MB),
- volume group lvUBUNTU with the following volumes: ubuntu-home, ubuntu-root, ubuntu-swap.
The installation is started by booting from an Ubuntu 8.04 Desktop LiveCD and installing the LVM2 support:
$ sudo -i
# modprobe dm-mod
# apt-get install lvm2
Now let’s activate the previously created volumes:
# lvs
LV VG Attr LSize Origin Snap% Move Log Copy%
ubuntu-home lvUBUNTU -wi--o 84,34G
ubuntu-root lvUBUNTU -wi--o 6,00G
ubuntu-swap lvUBUNTU -wi--o 1,67G
# lvchange -a y lvUBUNTU
# lvs
LV VG Attr LSize Origin Snap% Move Log Copy%
ubuntu-home lvUBUNTU -wi-ao 84,34G
ubuntu-root lvUBUNTU -wi-ao 6,00G
ubuntu-swap lvUBUNTU -wi-ao 1,67G
Logical volumes are now made accessible to the installer.
You can now install Ubuntu normally. This is particularly easy so we’ll skip this step. After the successful installation, you need to make the system bootable, as the installed initrd provides no LVM support.
Reboot your computer and boot from the Live CD again. Repeat the first couple of steps (but do not install Ubuntu again :P) and then let’s eventually install the LVM on your hard drive for good:
# sudo -i
# modprobe dm-mod
# apt-get install lvm2
# lvchange -a -y lvUBUNTU
# cd /mnt
# mkdir ubuntu-root
# mount /dev/lvUBUNTU/ubuntu-root ubuntu-root
# mount /dev/XXX ubuntu-root/boot
# ## warning: replace XXX with the actual name of your boot partition!
# mount -o bind /proc ubuntu-root/proc
# mount -o bind /dev ubuntu-root/dev
# cp /etc/resolv.conf ubuntu-root/etc
# chroot ubuntu-root
# ## let’s check the contents of /boot just to be sure we’re in the correct root
# ls /boot
abi-2.6.24-16-generic
config-2.6.24-16-generic
grub
initrd.img-2.6.24-16-generic
memtest86+.bin
System.map-2.6.24-16-generic
vmlinuz-2.6.24-16-generic
# apt-get install lvm2
# exit
# umount ubuntu-root/boot
# umount ubuntu-root/proc
# umount ubuntu-root/dev
# umount ubuntu-root
# exit
The system should now be bootable from your LVM. You can easily check that out after rebooting
Hope this article helped you set up your Ubuntu on LVM. In case of questions — there is a comment form just below. Please ask for LVM-specific things, questions regarding Ubuntu itself will be ignored by default.
Translated by michuk
Comments
- A hyperlink: <a href="polishlinux.org">GNU/Linux for everyone!</a>,
- Strong text: <strong>Strong text</strong>,
- Italic text: <em>italic text</em>,
- Strike: <strike>
strike</strike>, - Code: <code>
printf("hello world");</code>, - Block quote: <blockquote>Block quote</blockquote>













No comments yet.