How To Configure RAID and GRUB on Ubuntu 14.04 LTS
You probably know the feeling: You’ve got a box of new hardware and you can’t wait to assemble everything to build the Greatest Server EverTM. But when you sit down, you run into this seemingly unsolvable problem you just can’t seem to wrap your head around, even though it should be easy as pie.
I had that box of new hardware. An ASUS J1900I-C motherboard, two Kingston SSD drives and gigabytes upon gigabytes of RAM. I was going to build the greatest server ever. It would run Ubuntu 14.04 LTS in a sweet RAID1 configuration. With a nerdy grin on my face, I started the Ubuntu installation process. But of course I ran into a problem I just wasn’t able to solve: GRUB refused to install on my RAID1 setup. It failed with a fatal error1. Hour after hour went by as I tried to figure out why. I was desperatly searching the internet for a solution, but to no avail. Nothing worked. I had almost given up2, when suddenly… great success!
To save you a lot of trouble, here’s what I had to do get GRUB to install correctly on Ubuntu 14.04 LTS running in a RAID1 configuration on a server with an ASUS J1900I-C motherboard. It’s all about configuring the motherboard in exactly the right way. My board has the 0611 x64 BIOS version. If you don’t have this version of the BIOS installed on your own motherboard, your results may vary. Look for similar menu elements and change those.
- Boot your computer
- When you see the ASUS logo, press DEL to enter BIOS
- Press F7 to enter Advanced Mode
- Select OK to confirm
- Go to Boot tab
- Open the Secure Boot menu
- From the OS Type drop-down, select Other OS
- Press Escape to return to the Boot tab
- Open the CSM16 Parameters menu
- From the CSM Support drop-down, select Enabled
- From the Boot Device Control drop-down, select Legacy OPROM only
- From the Boot from Storage Devices drop-down, Legacy only
- Press F10 to save
- Select Yes to confirm
- The server will now reboot.
If you don’t use an ASUS J1900I-C, but have the same GRUB problems as I had, go through the BIOS settings and configure everything related to booting, OS selection, hard drive device controllers and similar settings to legacy or your BIOS' equivalent.
The rest of this “guide” will only take you through the parts of the Ubuntu installer dealing with the RAID setup, you’re on your own when during the rest of the installation process. I’m assuming that you know your way around the Ubuntu installer, so I’ll just show you a screenshot of what the end result of the manual disk partition step should look like. If you’re not entirely sure what’s up, you can follow the Ubuntu 14.04 Advanced Installation guide. Here’s the screen shot (you can ignore the SCSI1/sda drive and its partition, the sda drive is the USB stick I’m installing from):
I’m using two SSD drives in my server and if you are using SSD disks as well, remember to do this: When configuring the main partition (the partition with / as mount point), make sure you enable “discard” and “noatime” in the Mount options menu.
Notice the 16 GB swap partition in the screenshot above. To swap or not to swap is an almost religious discussion in the Linux community. I’ve decided to go old school, and use the recommendation I read back in the days when I first started playing around with Linux: Use a swap partition twice the size of the RAM in your server. It’s also recommended that you don’t swap to SSD disks, because it will reduce their life span, but this tip first surfaced many years ago, the situation might be different today. I had no choice either way, since I only use SSD disks in the server. If you’re unsure about anything swap partition related, do some research on the internet. It might be that you don’t even need a swap partition. What you can do is to prevent Ubuntu from swapping unless it absolutely has to. How is explained here. I recommend that you read the entire article, it has a lot of interesting information about SSD drives and Linux in general.
When you continue through the rest of the installation, GRUB will install successfully and you’ll eventually reboot your system with Ubuntu 14.04 LTS installed. While rebooting, it’s possible you’ll see an error saying “error: diskfilter writes are not supported.” Even if you are told to press any key to continue, the boot process will continue automatically after a few seconds. To get rid of this error, edit the file /etc/grub.d/10_linux and replace quick_boot=“1″ with quick_boot=“0″. Then run “sudo update-grub”.
Well, that was a major pain in the ass. Now that your RAID is finally configured and GRUB is happy, you can continue setting up your server. In the process you’ll undoubtedly come across more problems that seems impossible to solve. But you’ll get there in the end.
Ubuntu people: Why, for the love of Jebus, do you hide the actual GRUB error message from me? If it’s because you don’t want to scare off novice users, at least give me an option to see the error message. ↩︎
I wouldn’t actually give up, of course. I’m just writing it for drama. What would I with the 600 dollars worth of hardware? Store it in the basement? Return it to the store? Never! ↩︎