How to install UNR 9.10 on a netbook with multiple drives (LVM).

Soldato
Joined
8 Mar 2006
Posts
13,300
Location
Near Winchester
You may have a desktop, laptop or netbook with more than one storage volume, and wish that it was actually one big volume. For example, my EEE901 has a 4GiB and 16GiB SSD. You may have a netbook with an internal SSD and an SD card, or you might want to use LVM in some other funky way.

You should read the whole guide before attempting this. If you don’t understand what each line is doing by reading this guide, then LVM is probably a bit advanced for now.

NB: This guide will not work on ubuntu prior to 9.10 due do it not using grub2 and not having dm-mod built in to the kernel. If you understand the guide fully, then it should be a trivial matter of spotting where to install and insert dm-mod. Plus using a separate /boot.

What is LVM?
Logical Volume Management is a small local implementation of “storage virtualization”. In essence, you plug any number of different physical volumes into the back, and out of the front you can use logical volumes. These logical volumes can be of any number, size is not dictated by the back end disk sizes. You can also do mirroring, striping and snapshots (seemingly instantaneous copies of logical volumes). If you add physical volumes to the back, creating unused space in the storage pool, you can then grow logical volumes live. You often hear storage virtualization dismissed in the storage industry, but it’s actually the best thing since sliced bread.

This article will demonstrate an installation of ubuntu (UNR actually) 9.10 onto LVM, where 2 small physical volumes are used to create 1 big logical volume.
But wait, can’t we just use the alternate install disk with the Debian installer? Yes, but not if you’re installing the Netbook Remix. I personally prefer this method anyway.


Make a bootable ubuntu USB.
Download your chosen ISO (in theory this works with xubuntu and kubuntu too).

Make a bootable USB stick using a memory of 1GiB capacity or larger. This can be done in ubuntu using the Make Startup Disk tool, or in other distros and windows using UNetbootin.

Partitioning.
Boot from the USB stick, choose to “use ubuntu without changing your PC”.

Once you are at the live desktop, fire up GParted and make an unformatted partition on each of your disks. Being careful not to edit the USB stick. There is also no need for /boot, as grub2 used in 9.10 supports /boot inside LVM. You may still need a swap partition, it can be a logical volume if you like, I’m not going to use one since I have a netbook with an SSD.

gparted.jpg

(In case you are wondering, on an EEE, the 2 partitions at the end of sda are for the fast BIOS post feature. If you got rid of them and now wish you hadn’t, 2 unformatted 8MB partitions will work).

Creating the LVM Setup.
Before you create the LVM setup, we need to install some packages into the live session. In Software Sources, add the remaining repos:
Now install some packages:
Code:
sudo apt-get install lvm2 system-config-lvm
This will need to be repeated if you re-boot, unless you used the ubuntu tool to make the USB disk and you assigned space on the USB stick for files and settings.

If you don’t like the command line, you can do this in synaptic, you want the packages called “lvm2” and “system-config-lvm“.

Now we need to remove a safeguard in LVM, which will allow us to work with block devices which are not CD-drives. As root, edit /etc/lvm/lvm.conf so that line 52 onward looks like this (comment one line, uncomment the other):
Code:
# By default we accept every block device:
# filter = [ "a/.*/" ]

# Exclude the cdrom drive
filter = [ "r|/dev/cdrom|" ]
Don’t be fooled by the comments, there is actually a bug in the default filter, where it won’t let you initialise any SCSI block devices.

Now initialise each of the unformatted partitions you created:
Code:
sudo -s
pvcreate /dev/sda1
pvcreate /dev/sdb1
Now the partitions are LVM2 formatted, and ready for use by LVM.

Next we need to create a Logical Volume Group, this group will be made of physical volumes, and will contain the logical volumes, we’ll start by making one containing sda1, then add sdb1 to it:
Code:
sudo -s
vgcreate lvm_grp0 /dev/sda1
vgextend lvm_grp0 /dev/sdb1
We now have a logical volume group, the size of the physical disks it is made of, next we make a logical volume in this:
Code:
sudo lvcreate -l 100%FREE -n root lvm_grp0
“-l 100%FREE” means “use 100% of the free space in the volume group”. We now have a new block device, presented as /dev/mapper/lvm_grp0-root. Its function is like a partition, such as /dev/sda1.

If you don’t like the command line you can do this with the system-config-lvm tool:

sysconlvm.jpg

Installing.
You are now ready to install, fire up the installer from the desktop. Continue as usual, until you get to the partitioning page. Choose manual partitioning:

part1.jpg


part2.jpg

You will see all the physical device’s partitions, but more importantly, the LVM block device. Ignore all the physical devices and use /dev/mapper/lvm_grp0-root as whatever format you like, and with a mount point of /. Format it if you like, it makes no difference.

Do the same for the swap logical volume or physical volume if you are using one. Ext3 for now has some advantages with it being compatible with the system-config-lvm gui.

Just before you start the install, click Advanced… and have it install the boot-loader on /dev/sda, it’s no good installing a boat-loader to the beginning of a logical volume:

adv.jpg

Now click install and go make a mug of ubuntu, I mean coffee.

STOP; this installation is not ready yet!

Post Install.
What we have now is a system which:

* is installed to an LVM logical volume.
* has a usable /boot directory in this logical volume.
* has a usable grub 2 stage 1 installed to the boot disk.
* has a correct /boot/grub/grub.cfg for /boot and the kernels being inside lvm.
* has a correct /etc/fstab file.
* does not have lvm2 installed!

This clearly won’t work. We need to install lvm2 on the new system, here comes the clever bit, chroot into the new system:
Code:
sudo -i
mount /dev/mapper/lvm_grp0-root /target
mount -t sysfs sysfs /target/sys
mount -t proc proc /target/proc
chroot /target
We are now effectively using the new system’s console. Go ahead and get the package lists, there should be no need to add the extra software sources this time (if you do, don’t use the GUI), then install lvm2:
Code:
apt-get update
apt-get install lvm2 system-config-lvm
Control+d out of any terminals you now have open, it’s time to reboot into the installed system. Switch off, remove the USB stick, and boot from your internal disk.

Congratulations, you’re now free to experience the magic of LVM. If you find any bugs, comment and I’ll fix the article.
 
Back
Top Bottom