How to Install Ubuntu 14.04 with RAID 1 using desktop installer?
Many people claim that it is impossible to install Ubuntu onto RAID 1 with the Desktop CD. Is this really true? If not, how can it be done?
Edit: This guide does not take UEFI boot into account. Additional or different steps may be required if UEFI boot is desired. This guide assumes legacy boot!
It is true, that the ubiquity
installer does not know about mdadm
software raid devices. Also it is true, that the live-cd is missing the mdadm
raid administration tool. However, doing some work by hand, it is very much possible to install Ubuntu on RAID1.
In the following I will assume two identical hard disks (/dev/sd[ab]
) which will be used completely for our new install. To simplify the recovery if one drive fails, there will be only one mdadm
-volume /dev/md0
which will then be partitioned for /
, swap
and data storage, e.g. /home
.
After booting up the live-cd and (if necessary) configuring network access, open up a terminal and assume root access sudo -s
apt-get install mdadm
Now we create a single primary partition each of /dev/sda and /dev/sdb from sector 2048 to the end of the disk, for example using sudo fdisk
. I also like to already set the partition type to fd
for linux raid autodetection. The keystroke-sequence in fdisk
(if the disk is emptyin the beginning, meaning no partitions) is n <return> p <return> 1 <return> 2048 <return> <return> t <return> fd <return> w <return>
.
Now we create the mdadm
volume:
mdadm --create /dev/md0 --bitmap=internal --level=1 -n 2 /dev/sd[ab]1
I noticed, that the ubiquity
installer also does not quite manage to create partitions inside this /dev/md0
, so I also did this by hand - again using fdisk
. So on /dev/md0
create the following partitions:
-
/dev/md0p1
for your root filesystem, the size of course depending upon how much software you are going to install. -
/dev/md0p2
for swap, the size of course also depending on what you use the machine for and how much ram it's got -
/dev/md0p3
for /home, all the space that's left
After that we can begin the Installation. Make sure to start the installer from the terminal with the -b
option, because installing the bootloader will fail anyway:
ubiquity -b
Make sure to go for manual partitioning and "use" the 3 partitions you just created and tick the format
checkbox for /
and /home
so a filesystem will be created.
After the installation the system is not yet bootable, so do not restart the box right away. We need to chroot
into the installed system and fixup some stuff:
sudo -s
mount /dev/md0p1 /mnt
mount -o bind /dev /mnt/dev
mount -o bind /dev/pts /mnt/dev/pts
mount -o bind /sys /mnt/sys
mount -o bind /proc /mnt/proc
cat /etc/resolv.conf >> /mnt/etc/resolv.conf
chroot /mnt
apt-get install mdadm
nano /etc/grub.d/10_linux # change quick_boot to 0
grub-install /dev/sda
grub-install /dev/sdb
update-grub
exit
Now the newly installed system is ready to boot. Have fun!
Do not install Ubuntu Desktop CD with RAID 1. My advice:
- Use the Ubuntu Server CD to have a guided RAID 1 install. The manual for this is here (ignore the LVM part, not needed) :
https://help.ubuntu.com/lts/serverguide/advanced-installation.html - After that install the Ubuntu desktop environment with
sudo apt-get install ubuntu-desktop
- Reboot and you have a Ubuntu desktop (installed with the server cd).