How to Install Ubuntu Server 12.04 with Encrypted LVM on RAID1

Manual Partitioning in Ubuntu Server 12.04 Installer

When the installer gets to the partitioning section, choose “Manual.”

At first the tool looks pretty simple, but it’s about to get a bit more complicated. Use your keyboard arrows to select your first hard drive and press enter.
The installer asks you if you want to create a new empty partition table. Select yes.
You return to the main partitioning screen, but now there is a new entry under the first drive: free space. Select that entry and press enter.
Here we are going to create our first partition. Select “Create a new partition” and press enter.
The installer will assume you want to create one partition that is the size of the entire disk. That is NOT what we want to do. Change the partition size to 550 MB. This is going to be the partition we use for the boot directory, so it doesn’t need to be any bigger than that.
Yes, we want it to be a Primary partition, so press enter.
Since the partition isn’t taking up the whole disk, the disk partitioner needs to know where to put it. Some might tell you that the boot partition has to be at the front of the disk, but this isn’t true. I prefer to put mine at the end so that I can put my swap space at the beginning of the disk (because the beginning of the disk is faster than the end). You can put it wherever you want to because GRUB2 can find it in either location. Make your selection and press enter.
After creating the partition, you are immediately taken to the screen to edit it. It defaults to being used as an ext4 filesystem. If you were just using one disk, that would be fine, but we are trying to set up a RAID1, so that’s not what we want. Select the “use as” entry and press enter.
We want to use this area as “physical volume for RAID,” so select that and press enter.
This is going to be for the /boot partition, so it needs to be bootable. Navigate to the “bootable flag” entry and press enter to toggle it to “on.”
That’s all we need to do with this partition at the moment, so select “done” to return to the main partitioning screen.
This screen now shows two entries under the first disk: one is the partition you just created, and the other is all the remaining free space. That’s where we are going to create our next partition, so select that and press enter.
Again, we are going to create a new partition.
The partitioner needs to know how big to make this second partition. This tutorial is only covering a two-partition setup, so we are going to keep the default size, which is all of the remaining free space. If you are creating other partitions (e.g. a separate /home partition), then obviously you will need to do that before you fill up the whole disk.
The partitioner will default to make the second partition logical, but we want it to also be a primary partition. Select that and press enter.
Again the partitioner defaults to using the partition as ext4, but this will also be used in a RAID so select the “use as” entry and press enter.
We want to use this partition also as a physical volume for RAID.
In this case, we are leaving the bootable flag off, so we are done editing the partition. Select done and press enter.
Now that we’re back to the main partitioning screen, it’s time to do the same thing to the second hard drive.
Since it is literally step-by-step the same exact process as we just did for the first drive, I won’t repeat how to partition the second drive. Just do the same thing. At the end you should end up with a screen like this showing two identically partitioned drives.

Comments

Now with the new installers the bootable flag cannot be set to on for the raid partitions which means you cannot configure raid 🙁 Moreover the boot now is by default set to EFIboot which complicates things even better. The combination of raid 1 and lvm is critical for professional environments. This is a great tutorial. Could you update it? That would be awesome. Thanks!

I am having a problem with this setup. If I unplug either drive, the system will not boot. I get the error message: “Begin: Waiting for encrypted source device……”. So far I have not been able to find any help on what the solution to this is.

The instructions here are very clear and helpful. BUT I built it with Ubuntu Server 14.04.1 and have the same problem as Gary – if I unplug either drive and boot, the system says “no volume groups found … waiting for encrypted source device”

I then rebuilt with RAID->LUKS->LVM rather than RAID->LVM->LUKS but get exactly the same problem.

Lst time I tried this (in 2010) the same problem cropped up. I really don’t think Ubuntu has paid much attention to the need for encrypted RAID to work.

I even tried putting a clean disk in place of the “removed” disk to see if it rebuilt, but still says just “waiting for encrypted source device”.

I gave up on Ubuntu for this. Instead I installed a minimal version of Debian 6.0.10 and the encrypted RAID works perfectly; that is removing either drive still allows you to enter your passphrase and log in.

Seems to me there is no point using Ubuntu for encryption with RAID if you can’t boot when a drive fails. And since I am about to build a HP microserver for file storage, I do not want to get burnt by a buggy RAID/Encryption setup.

Thanks “the new guy” for the detailed instructions though, they are probably applicable to Debian and maybe other OS’s too.

I also have “The new installer”, downloaded today and the bugs that George Pligor speaks of are also preventing me from being able to configure a software RAID 1 array on Ubuntu 12.04.3 LTS 64-bit Server.

Some of the changes include:
Not being given a choice to make a partition Primary or Logical.
An added line to give a partition a name
The inability to set the Bootable Flag to “on”.

The bootable flag of course is the killer. It means grub will not instal.

I am unsure why they changed the installer, but I really wish they hadn’t.

I would really like to get my hands on the old installer because the new installer doesn’t recognize a hardware RAID1 array setup in the Intel RAID Utility on my Gigabyte Z87M-D3HP Motherboard either.

turns out the problem was that I was using 3TB HDDs. anything bigger the 2TB and the Partition table needs to be forced to GPT.
The current installer is not able to cope with rives larger than 2TB for RAID.

You need to set the partitions up first in something like GParted (I used GParted Live CD, or you can use Ubuntu Desktop Live DVD and use its GParted.)

explicitly set the Partition table to GPT.
create a partition at least 1.0MB with no file system and set its flag “biosgrub”
create your swap partition and set its flag “raid”
create your main partition and set its flag “raid”
repeat for the other HDD

exit and begin normal instal.

Once you get to the Partitioner, the partitions are already setup, just do the RAID Configuration.
Create MD swap
create MD main
back in the partitioner, choose swap in the array and choose “use as” – swap area
choose the main in the array and choose “use as” – ext4 – mount – / (root)
DONE.
not need to worry about setting bootable flag.
Finish and write changes to disk.

I read this 2 years later and it’s going to save my day! I had no idea the 2GB limit was a problem, took me forever to start searching and here, of all places my search hits sent me to, at last I find a decent explanation…
Thx a zillion!

I have a question, need advise / help.
With the same setup like the example with a RAID 1 with 2 drives setup , if one of drive is dead and what steps to recover the array after a brand new unformatted hard drive is replaced .