• Home
  • About
  • Contact
  • Store

IT from Scratch

Small Business IT from the ground up

How to Install Ubuntu Server 12.04 with Encrypted LVM on RAID1

July 30, 2013 By The New Guy 22 Comments

Setting up Encryption

Back at the main partitioning screen, we need to tell the installer what these logical volumes we just created are going to be used for — namely, encrypted logical volumes.

Select the first volume and press enter.

Select the first logical volume

The partitioner doesn’t know what to do with the volume until we tell it, so select the “use as” section and press enter.

Select "use as"

Here we establish that the root filesystem will be encrypted. Choose “Physical partition for encryption” and press enter.

Select physical volume for encryption

The partition settings screen now shows several encryption-specific options, but we don’t need to change anything because all the defaults are how we want them. Select “Done setting up the partition” and press enter.

Done setting up first encrypted LVM

Now we do the same thing for the second volume. Select it from the main partitioning window and press enter.

Select the second volume

Again, by default the system doesn’t know what to do with it, so select the “use as” section so we can enlighten the installer.

Select "use as"

This volume will also be encrypted, so select “Physical volume for encryption” and press enter.

Select physical volume for encryption

The encryption options will be mostly correct, but instead of using a passphrase for this volume, we’re going to use a random key. This is because this area is going to be used for swap space. Swap space is not persistent across reboots, so it doesn’t need to be unlocked with the same key. It can be decrypted with a random key that is only valid for that boot. On the next boot, the system will generate a new key and write over the swap space.

The benefit for you is that you only have to enter one passphrase — the one for the root filesystem — instead of two.

To change this, select “Encryption key” and press enter.

Select encryption key

Then select “Random Key” and press enter.

Select "Random Key"

Select “Done setting up the partition and press enter.”

Done setting up partition

Back at the main partitioning screen, select “Configure encrypted volumes” and press enter.

Configure encrypted volumes

The partitioner warns you that after encrypted volumes are configured, you can’t change them. If you are satisfied with your settings up to this point, select “yes” and press enter.

Confirm encrypted volumes

On the next screen, choose “Create encrypted volumes” and press enter.

Create encrypted volumes

Select the devices you want to use for encryption with the arrow keys, and mark them with the space bar. Press enter when your chosen devices are marked.

Select devices for encryption

Select “Finish.”

Select finish

The partitioner now prompts you for your encryption passphrase. This is the passphrase for the root filesystem. It will be needed any time you boot or otherwise access this filesystem.

Enter your passphrase and press enter.

Enter encryption passphrase

Confirm the passphrase and press enter again.

Confirm passphrase

Back at the main partitioning screen again, it’s time to say what we want to use those encrypted volumes for.

Select the first encrypted volume and press enter.

Select the first encrypted volume and press enter.

The partitioner defaults to use the volume as an ext4 filesystem. We just need to tell it where to mount it.

Select “Mount point” and press enter.

select mount point

Select “/ – the root filesystem” and press enter.

Select the root filesystem

That’s all we need to do here. Select “Done setting up the partition” and press enter.

Done setting up the partition

When you return to the main partitioning screen, you can see the second encrypted volume is already set to be used as swap, so you don’t need to even bother going into the partitioning editing section for this volume.

Encrypted swap volume is set already to be used as swap space.

But if you do decide to go in to make sure, this is what you should see (and if this isn’t what you see, this is what you should set it to).

Encrypted volume already set for swap

Tying up any Partitioning Loose Ends

Before we move on with the rest of the installation, we just need to configure the boot partition.

Select it from the main partitioning screen and press enter.

Select boot partition

Select “use as” and press enter.

Select "Use as"

Choose the filesystem type you want to use for your boot partition. I’m sticking with ext4. Press enter after you make your selection.

Choose filesystem type for the boot partition

Select “Mount point” and press enter.

Select mount point

Select “/boot — static files of the bootloader” and press enter.

Select "/boot -- static files of the bootloader"

Select “Done setting up the partition” and press enter.

Done setting up the partition

Pages: 1 2 3 4 5 6 7 8

Filed Under: Scratch

Comments

  1. George Pligor says

    October 1, 2013 at 9:05 am

    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!

    Reply
    • The New Guy says

      November 22, 2013 at 9:56 am

      I’m not sure what you mean by “the new installers.”

      Reply
      • Mr.Gosh says

        July 23, 2015 at 6:33 am

        he means the installers from 14.04 – these changed many things…

        Reply
  2. Jonathan Corbett says

    November 20, 2013 at 2:49 am

    Thank you — this was extremely helpful!!

    Reply
    • The New Guy says

      November 22, 2013 at 9:55 am

      Hey, Jonathan! Glad to hear it helped.

      Reply
  3. Gary Attaway says

    November 22, 2013 at 1:10 am

    Great tutorial. Thanks for taking the time to do this.

    Reply
    • The New Guy says

      November 22, 2013 at 9:56 am

      Thanks, Gary. Glad to help.

      Reply
  4. Gary Attaway says

    November 22, 2013 at 8:22 am

    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.

    Thank you,
    Gary

    Reply
    • Tony says

      August 4, 2014 at 5:28 pm

      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.

      Reply
    • Tony says

      August 4, 2014 at 8:44 pm

      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.

      Reply
  5. Alan Netherclift says

    January 8, 2014 at 7:02 am

    Hi The New Guy.

    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.

    Reply
  6. Alan Netherclift says

    January 9, 2014 at 4:50 am

    OK, so there is no such thing as a “new installer”

    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.

    Install will then work.

    This is only for HDDs above 2TB that this is necessary.

    solution found here:
    http://ubuntuforums.org/showthread.php?t=2109438

    Reply
    • The New Guy says

      January 18, 2014 at 11:00 pm

      Thanks for your input, Alan. Those bigger drives pose some interesting challenges.

      Reply
    • nn says

      April 2, 2016 at 5:24 pm

      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!

      Reply
  7. Joe says

    January 18, 2014 at 6:47 pm

    This guide was great – thanks for taking the time to prepare!

    Reply
  8. Benson says

    January 23, 2014 at 2:38 pm

    Hi The New Guy,

    Thanks for the effort , the tutorial is clear and very helpful.

    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 .

    Reply
  9. Ally B says

    February 1, 2014 at 8:50 am

    Good documentation like this is priceless thank you for taking the time to write it 🙂 I am interested in Ubuntu administration and will be following this site for future entries

    Reply
  10. XCiber says

    February 3, 2014 at 12:16 am

    There be any problems with an encrypted partition by adding another PV in LVM? Could you describe the process more?
    1) Create new PV (only one drive without MD for simplify): pvcreate /dev/sdc
    2) Add PV to VG: vgextend linus /dev/sdc
    3) Extend LV: lvextend -LXXX /dev/linus/root
    4) Anything with /dev/maper/linux-root_crypt??
    5) Resize fs: resize2fs /dev/maper/linux-root_crypt

    Reply
    • XCiber says

      February 3, 2014 at 11:45 pm

      4) cryptsetup resize…

      🙂

      Reply
  11. metrik says

    March 18, 2014 at 1:06 pm

    Thank You!
    This is extremely helpful and easy to follow!

    Reply
  12. Marvin says

    June 3, 2015 at 5:00 pm

    Is not /home missing in this tutorial or is it created automatically within / ?

    Reply
  13. ram says

    November 8, 2015 at 2:58 pm

    Awesome tutorial! Thanks a lot!

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Click Here for 500 MB free VPN connection through Private Tunnel

Recent Posts

  • How to Get the macOS Catalina Installer, Post Big Sur
  • Mac: How to Get SHA1 Hash
  • iTunes error: “You do not have enough access privileges for this operation”
  • Is Websense Filtering My Internet Traffic?
  • How to Delete a Mac VPN Profile
  • Home
  • About
  • Contact
  • Store

Copyright © 2025 ·WP-Ubuntu