Ben's Pro Tips

Tech Tips Made Easy

February 7, 2014 Linux Server Tips hard disks, linux mint, raid, storage, ubuntu

Adding a RAID1 array to an existing Ubuntu 13.10 installation

I recently had the joy of adding a RAID1 array to my Ubuntu 13.10 server. I came across a number of problems setting it up, the foremost being the lack of an up-to-date guide for Ubuntu. Most of them, including Ubuntu’s own documentation were woefully out of date.

After several failed attempts, I was able to successfully install a two-drive redundant RAID1 array. Here are the steps I used.

1) Make sure both drives are roughly the same size and installed on the system, your live drive will be /dev/sda for this example and your new drive /dev/sdb. I’d highly recommend backing up /dev/sda before you start.

2) Install mdadm

apt-get install mdadm

3) Download Raider here

4) Install it with the following commands:

cd ~
 tar xvfz raider-0.13.2.tar.gz
 cd raider-0.13.2
 ./install.sh

5) Once it’s installed, run raider to erase the new drive, then partition and sync it:

raider --erase sdb
raider -R1 sda sdb

6) Ignore any warnings about single user mode and continue. Raider will partition the drive, copy the data over, and configure grub on both drives to use the new array.

7) Shut down the machine, and swap the SATA drive cables to make sda -> sdb and vice versa. Boot the machine, it’ll be booting from the new drive.

7) Once up, run raider again to sync the drives:

raider --run

8) [NOTE– if the above command worked, you’re already done, this step is not needed] For some reason on my machine raider refused to sync the drives saying “New disk must be connected to the last slot!” nomatter which drive I had in which slot. No problem, you can finish the process manually with mdadm:

Run the command:

/sbin/mdadm --detail /dev/md0

You should get output like the following:

/dev/md0:
        Version : 1.2
  Creation Time : Fri Feb  7 11:35:08 2014
     Raid Level : raid1
     Array Size : 471741248 (449.89 GiB 483.06 GB)
  Used Dev Size : 471741248 (449.89 GiB 483.06 GB)
   Raid Devices : 2
  Total Devices : 1
    Persistence : Superblock is persistent

    Update Time : Fri Feb  7 13:05:55 2014
          State : clean, degraded 
 Active Devices : 1
Working Devices : 1
 Failed Devices : 0
  Spare Devices : 0

           Name : devserver:0  (local to host devserver)
           UUID : a55fd0fe:7b142a4c:ad0d9a93:e97e9483
         Events : 8834

    Number   Major   Minor   RaidDevice State
       0       8       17        0      active sync   /dev/sdb1
       1       0        0        1      removed

This tells use that only 1 of the 2 RAID devices is working: /dev/sdb1. We need to add /dev/sda1 to the array. To do this run:

mdadm /dev/md0 -a /dev/sda1

Running the mdadm detail command will now show the drives are syncing. Give them time to sync up; it could take hours depending on your drives, and reboot. You should now have a redundant RAID1 system. If you want to add more drives, you can with the above mdadm -a command.

This was done on an Ubuntu machine, however the same or similar steps should work on Linux Mint or Debian.

2 to “Adding a RAID1 array to an existing Ubuntu 13.10 installation”

Trackbacks/Pingbacks

  1. […] week we looked at making a single-disk system redundant by setting up a raid array. Today we’re going to see how to add a new disk to the array. It’s a good practice to […]

  1. Adding a drive to your RAID1 array on Debian/Ubuntu/Linux Mint | Ben's Pro Tips says...

    […] week we looked at making a single-disk system redundant by setting up a raid array. Today we’re going to see how to add a new disk to the array. It’s a good practice to […]

  2. AriusArmenian says...

    Thank you for the instructions. I will be trying Raider today using a backup of the boot disk and a spare.
    Questions:
    1- How do you know if one of the disks in the RAID1 has failed?
    2- What is the procedure to replace a failed disk and resync the raid set?

Leave a comment

Time limit is exhausted. Please reload the CAPTCHA.