# Ubuntu – How to install Ubuntu 12.04 server with RAID1

installationpartitioningraid

I have spent the last 4 days or so trying to setup Ubuntu server 12.04.2 with RAID1. I have looked at several different links and tried different configurations and workarounds. So far, I have not come out with a successful installation that passes the final test — pulling out one drive, booting and checking the contents of my home folder, and doing the same for the other drive.

So far, the closest I have come to succeeding is by setting up partitions this way:

/dev/sda1: allocated for RAID
/dev/sda2: swap area
/dev/sdb1: allocated for RAID
/dev/sdb2: swap area (or left unassigned -- which somehow gets allocated as a swap area later on anyway)
/dev/md0: (paired sda1 and sdb1) RAID1 device, ext4 filesystem, mount point /


This installs successfully, I boot the system, then create a file called "test" on my home folder.

I then shut down, disconnect drive b, power up, and check my home folder. "test" is there…so far so good. Then I create a second file, "test2."

I shut down, reconnect drive b, power up, and check the folder. Both files are there.

I shut down, disconnect drive a, power up and check the folder. Both files are ABSENT from drive b.

If anyone has any ideas on how I can successfully set this up and get my RAID1 working, I will be very grateful and happy.

Oh yes…I've tried setups with 3 partitions instead of 2, with EFI Boot and/or biosgrub, with no success (Either it would not boot, or I encounter the same situation with the test results above)

Thanks.

• After more research, trial and error, and one phone call to a friend, I finally got this to work.

Apparently, there is something wrong with the Ubuntu Installer's partition manager -- so I had to use GParted (http://gparted.sourceforge.net/) to partition the disk BEFORE running the installer.

I setup 2 partitions with gparted (ext4 and swap), then ran the Ubuntu installer, set up raid, and everything went on smoothly.

When I ran the test (pulling out one drive), the test file I wrote still existed on the second drive and that proved my raid installation worked.

Just a note: when I plug the other drive back in, it does NOT automatically sync back. I have to re-add it to the raid array by:

sudo mdadm --add /dev/md0 /dev/sdb1


(replace md0 with the actual raid array name and sdb1 with the actual hard drive name)