NAS 5: mdadm adventures


Since I decided to proceed with software RAID, I had to figure out how to get it up and running. After browsing a few articles, I followed the outline of this one to set up mine. I made several errors and I guess that’s something to learn from. I think I’ll keep it short so you can see what the process is without going through a whole lot of text.

  1. First I created the partitions on /dev/sdb and /dev/sdc my two HDs. Refer to NAS 3 post for explanation. I used Gparted to do this, creating a primary partition and left it unformatted on both devices.
  2. Next I ran the following command:
    mdadm --create /dev/md0 --level=1 --raid-devices=2 \
     /dev/sdb1 /dev/sdc1
  3. Followed by this:

    mdadm --detail --scan > /etc/mdadm/mdadm.conf
  4. I hit a snag on 3, where I was getting a permission denied error. I found this post which solved the issue for me
  5. So in effect I ended it up running the following commands:

    sudo -i
    mdadm --detail --scan > /etc/mdadm/mdadm.conf
  6. To use the RAID I’ve got to format and make it available for use (mounting). So following the above commands I enter the following:

    mkfs.ext4 /dev/md0
    mkdir /raid1
    mount /dev/md0 /raid1
  7. The final bit is to edit the /etc/fstab file to edit that at the end of the commands in 6, type the following:

    gedit /etc/fstab
  8. You should see a graphical editor. Add this line to the end of the text on a new line (please use tab to separate the text instead of spaces):

    /dev/md0     /raid1    ext4    noatime,rw  0   0 

And voila, I’ve got an up and running RAID.

I open up a disk explorer (open any folder and point to the file system) and right click on raid1 and choose “sharing options”.  When I check “Share this folder”, I get the option to install Samba. I’m currently installing it. Once done, I should have a shared folder called RAID1 available to everyone!

I’ll just wait until the resync is done. Then, I’ll do a reboot to see if things are working as expected. If they are, my mission will be complete.

I expect I’ll have to work on some networking permissions to ensure that all computers on the home network are able to access the folder. I may also have to ensure (through firewall rules?) that this folder is accessible only via the home network.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s