Duplicate Article
This article covers the same material as another article. More info...


Candidate for Deletion
This article may not be appropriate for this wiki, and may be deleted. More info...

Hard drives are getting cheaper by the day, so if you are looking for a way to vastly increase your Ubuntu installation's performance, you might want to consider setting up a striped volume across multiple disks (a.k.a RAID0). In this article I will show you how to create the volume and install Ubuntu Jaunty into it.

First, boot into the Live CD. I didn't try this with the Alternative Install CD, but I know it works with the standard. When you are in, you need to make sure you are connected to the internet.

Setting up partitions

You will need to make sure that you create a partition on each disk. There are many programs you can use; I like gparted, so I used that. Create one partition on each disk (these will be used for the striped volume), and you also need to create a tiny partition on any one of the disks for your /boot directory, which will not be contained in the striped volume. My /boot partition is 800Mb, which is more than enough; yours should be at least 100Mb.

Installing and using LVM

Next we need to create the logical volume. Install the lvm2 package:

  • $ sudo apt-get install lvm2

Next we need to create one physical volume for each partition that will be included in the striped volume (NOT the one you will use for /boot). This process prepares the partition for inclusion in a "virtual group" (more on that later). Replace "/dev/sda1" and "/dev/sdb1" with the partitions you want to use.

  • ||

    $ sudo pvcreate /dev/sda1 ||

    $ sudo pvcreate /dev/sdb1

    {repeat command for each partition you wish to use}

Now we will create a virtual group. This will be a group of physical volumes accross multiple disks that will act like a single disk that we can create logical volumes on in the next step. Choose a name for your virtual group; I am using "MyVirtualGroup" as an example:

  • $ sudo vgcreate MyVirtualGroup /dev/sda1 /dev/sdb1 {keep listing physical volumes separated by a space as needed}

We will now carve out chunks of the virtual group and create logical volumes in the chunks, just like we would normally carve out chunks of a hard drive and create partitions in them. You will use the lvcreate command; here is the basic syntax:

  • $ sudo lvcreate -i <number of physical volumes to stripe> -I <size of stripe in killobytes> -L <size in megabytes>M <name of virtual group>

Here is what I did as an example:

  • $ sudo lvcreate -i 2 -I 8 -L 60000M MyVirtualGroup

This command creates a 60 gigabyte logical volume on MyVirtualGroup with stripes on two disks, with each stripe 8 killobytes in size. This command will generate the logical volume's name (when I ran it the name was "lvol0"). In the future, if you need to reference this volume, it will be /dev/<virtual group name>/<logical volume name>. So our example above would produce a volume that can be referenced at /dev/MyVirtualGroup/lvol0.

Now that you have your logical volume you must create a filesystem in it:

  • $ sudo mkfs.ext3 -m 0 /dev/!MyVirtualGroup/lvol0

You might want to use a striped logical volume for your swap partition; I didn't do that but if you want to you should be able to by repeating the steps above.

If at any point during the process you want to reverse a step and do it over or start over from the beginning, you can use the "pvremove", "vgremove", and "lvremove" commands.

Installing Ubuntu into the striped volume

Fire up the installer, select your language, time zone, and keyboard configuration, and when the partition screen comes up, select the option to manually configure your partitions. That will open a window containing a list of partitions; you should see your logical volume listed. Select it and hit Edit. That will open a window that will allow you to specify that you wish to use it for your root partition (you will select "/" from the drop-down menu), and you can also specify a file system (I used ext3). Make sure you check the box telling it to format the partition. Hit OK; you will return to the screen with the list of your partitions. Repeat these steps for the partition you wish to use as your /boot partition, specifying "/boot" in the drop-down menu. Specify a swap partition in like manner. When you are finished with all that stuff hit Next and continue with the installation process as normal.

When it is finished installing Ubuntu into those partitions it will prompt you to reboot the computer. Don't do that yet; we still have one more step.

Adding LVM support to the new Ubuntu installation

The default Ubuntu kernel does not have support for LVM, so an initrd is required to boot into a logical volume. I've found the task of creating initrds difficult, but fortunately the lvm2 package takes care of that for you. To install lvm2 into the new Ubuntu installation you will mount the logical volume and boot partition, like so:

  • $ cd /

    $ sudo mkdir target

    $ sudo mount /dev/MyVirtualGroup/lvol0 /target

    $ sudo mount /dev/sda2 /target/boot

Replace /dev/sda2 with the location of your boot partition. Next, chroot to the Ubuntu installation:

  • $ sudo chroot /target

Then install the lvm2 package

  • $ sudo apt-get isntall lvm2

A warning about striped volumes

For those of you still new to striped volumes, you should be aware that it does not allow for any redundancy at all. This means that if one of the drives should ever fail, the entire volume would be lost. It is imperative that you do good backups if you use this configuration.

This is my first how-to so if anyone sees anything that needs improvement, please dive right in!

StripedVolumeHowTo (last edited 2017-09-10 19:29:40 by ckimes)