Install Ubuntu 12.04 with RAID/LVM on UEFI system

After spending almost a day trying boot my newly installed Ubuntu 12.04 server edition I finally figured out what was the problem. So I am posting this maybe someone is in the same situation as me and it will find this helpful. I don’t know if my method is the best/recommended one, but it works.

Symptoms:

After installing Ubuntu and rebooting you are presented with black screen asking to insert bootable media. Not even GRUB. You probably have a newer PC and when entering BIOS you notice that it has a better looking menu (compared to old text modes we had for so many years) and some options about (U)EFI.

Fix:

Download GParted live USB/CD and “burn” it to a CD or USB. I used LinuxLive USB Creator to write it to USB stick from Windows, after reading this page.

Insert the USB stick into the new PC and boot. Press the key to chose Boot menu. In my case it was F12. From the menu select “EFI: USB harddrive” (this may look different for you, but make sure you select the EFI entry). After the live CD/USB loads everything you are presented with GParted interface. I had two harddisks since I was trying to make RAID. I made the following partitions:
/dev/sda:

  • 128 MB vfat32 partition for EFIboot, select “boot” flag for it (right click on partition, Make flags)
  • rest of the space as another partition, unformatted , select “raid” flag

/dev/sdb:

  • 128 MB xfs partition for /boot (you can use anything you want for file system)
  • rest of the space as another partition, unformatted, select “raid” flag

Write the partition changes to HDD and reboot.

Insert Ubuntu 12.04 Server edition USB stick (or CD). Press Boot menu key (F12 for me) and again select “EFI: USB Harddrive” (or whatever is called for you). When you get to the partition scheme chose “Manual” and do the following:

  1. ¬†Select the vfat32 partition and make sure “Boot flag” is “on” and select “Use this -> EFIBoot partition” (where you normally select file system for a partition). Done with this.
  2. Select the other 128 MB partition from 2nd HDD and use it to mount /boot
  3.  Configure software RAID (Create MD device, RAID1, 2 devices, 0 spare, use /dev/sda2 and /dev/sdb2)
  4. Configure the LVM using /dev/md0 as Physical Volume and create a Volume Group on it (I named mine VolGroup00). Now create as many Logical Volumes as you need. I created 4, but feel free to use as many as you need.
    • 10 GB LogVolRoot for /
    • 10 GB LogVolTmp for /tmp
    • 16 GB LogVolSwap for swap space
    • rest of the space as LogVolVar for /var (I was going to install ISPConfig on this server and most of the files are located in /var in this case).

    You can go without /var and /tmp separated volumes if you want. The recommended swap is space is 2x RAM if you are under 2GB RAM, and RAM+2 if you have over 2GB RAM.

  5. Select each of the Logical Volumes you have created and assign them the right mountpoints and use what file system you want. I used XFS for all since it allows me to grow the partition on the fly and freeze the file system. I’ve also selected (nosuid, noexec) for /tmp and (usrquota,grpquota) for /var.

At this point you should be done, write everything to disk and continue with normal install. When you get to boot loader part you will notice that GRUB won’t ask anything about MBR or other things. It will simply install “grub-efi-amd64” (or something like that, was too fast). If it asks you about MBR or where to install itself then you did something wrong.

Things to note:
I know I should/could have tried to put /boot on RAID/LVM. I’ll try this next time.

jd

nice writeup!

this setup method is still up-to-date and the only method of running a system not in legacy mode.

two things that are in my mind ..

1) you should mention that the harddisk had to be GPT ( http://en.wikipedia.org/wiki/GUID_Partition_Table ) that this work (meaning setup the 128 MB Partition

2) if the first disk fail you need to recover or rebuild the uefi partition as well – if the second disk fail you need to rebuild /boot

did you ever need to rebuild on of the disks?

Octavian

Hi, thanks for your words! Indeed the harddisks have to be GPT, you can use Gnuparted live CD to do that. Regarding 2) I didn’t have to recover/rebuild, but that’s my main concern in case of crash. Still don’t have an elegant solution to the problem.

Server setup ISPConfig 3 with Ubuntu 12.04

[…] Note: If you are using a system that has (U)EFI you might want to partition your disks before using GParted and you will need to create an EFIBoot partition of about 100MB at the beginning of HDD. To keep things looking nice you can create 2x 128MB partitions on both harddisks(one on each). More details about this on my previous article “Install Ubuntu 12.04 with RAID/LVM on UEFI system” […]

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