Configuration

Mounting

Once the Volume Formatting has completed, you will have some additional information in the Volumes section.

You will also have some additional buttons. One of these, Mount Volume, will allow you to quickly mount your brand new RAID array quickly and easily, however this will not mount it automatically and will only mount it at /media/Array Name.

This is handy for testing the array, or if you’re tired and don’t feel like setting it up properly currently. However, if you want the array to mount automatically everytime you reboot the system we have some more work to do (but not too much!).

Create Mount Location

First off, we need to figure out where we want the RAID array to mount at. Traditionally this would be under /mnt, and Ubuntu tends to put everything under /media. Either of these are fine if this is your preference. You may also choose to mount it elsewhere, such as in your home folder (/home/$USER/MOUNTHERE).

Whatever you decide, we’ll need to first create a folder so we can mount the RAID array in it. For ease of access, and ease of setting it up. I’m going to use /home mounting as the example here.

To create a folder, for the mount point simply go up to Places and then select Home Folder. This should open up a file browser in your home director (with your Downloads, Documents, Pictures, etc folders in it).

To create a folder simply right click somewhere in the space between the folders and files and select Create Folder, now rename the folder to whatever you want, I’ll use RAID for the rest of the guide.

So, now you should have the folder RAID in your home folder. The full path to this is /home/YOURUSERNAME/RAID. You can see this by hitting Control-l on your keyboard with the new RAID folder open in your file browser (and in focus).

/home/user/RAID

You will need this path, so copy it somewhere safe or keep it fresh in your head. To create a new entry simply copy what’s below and paste it at the bottom of your fstab file.

Universally Unique Identifier

Now that we have a folder to mount the RAID array in, we need to know the location of the array itself so we can tell Ubuntu to put the array into the folder we just created automatically.

This is simple to find, but we need to pull up the Terminal to do so.

To find the Terminal, go up to Applications then to Accessories, and select Terminal.

Now, a box with a flashing prompt should open up. In here type the following,

sudo blkid

Hit Enter, then enter in your password, hit Enter again and you’ll be presented with a list of information.

In this list, likely at the bottom, should be an entry that’s something like:

/dev/md0 Label="Volume Name" UUID="...." TYPE="ext4"

Notice the /dev/mdX bit, this indicates that it’s a multi-disk device. This should help you in filtering out the normald hard drives which should be something like /dev/sdXX.

Note: If you do not see /dev/md0 in here, open up Disk Utility once again, go to your RAID array and make sure it’s started (then re-run the above command)!

Once you have located your RAID array, copy everything (by highlighting with the mouse and then right clicking, Control-C wont work here) between the quotation marks for UUID=”COPY EVERYTHING IN HERE”. This will be a long string of letters and numbers and will look something like this.

cff980fe-8812-4bc9-b385-822563b26aee

Again, you want everything in the quotation marks, nothing before nothing after, just this string.

File Systems Table

Now that we have the folder we’re going to mount the RAID array in, and the location of the RAID array itself we’re ready to setup Ubuntu to automatically do this for us.

To refresh, the RAID folder’s path should be something like

/home/$USER/RAID

And, the location of the RAID array itself should be like

cff980fe-8812-4bc9-b385-822563b26aee

If you don’t already have these, revisit the steps above to get them.

Now, we’ll need to be once again in the Terminal.

Once that’s opened, type in the following.

sudo gedit /etc/fstab

This will open the fstab file in a text editor with root (or administrative) privileges.

Once this file is open, do not modify anything in here unless you know exactly what you are doing. You can break your system if you mess something up in here, so be warned!

Depending on your system there should be at least two entries in here. One for your root partition and one for your swap partition. Note these, and also note the other information in here. If you can, try to get a sense for what is going on in this file (note the headings).

A single entry will look something like this:

UUID=01e65c1b-dc97-42fc-9dd5-da229f094c7b   /   ext4   errors=remount-ro   0   1

So, now we need to add a new entry for our RAID array. Also, while you’re here, if you had previous disks mounted that were retooled to be used on the RAID array you may want to comment them out simply by placing a pound sign (#) in front of their entry (see the image for an example).

Again, don’t comment out your root drive (/) or your swap drive or anything else you might need! When in doubt leave it alone!

# This was added by hand for the new raid setup.
UUID=YOURRAIDUUIDHERE /home/USER/RAID ext4    defaults        0       2

So, once this is in your fstab file, simply replace the YOURAIDUUIDHERE with the string we copied above and then replace /home/USER/RAID with the path to the folder we created to mount the RAID array in. Leave the rest alone unless you know what you’re doing and Save and close (after triple checking!).

So, now Ubuntu knows where to mount the array and will do so at system boot automatically! We’re just about good to go here. However, the array will not yet start automatically, so it cannot be mounted if it’s not started. Move on to the next section where we will rectify this.

Multi-Disk Administrator Configuration

So, lets recap here. We currently have the RAID array partitioned (GPT), synchronized, and formatted with a file system (EXT4). We have Ubuntu configured to automatically mount it into our folder of choice for easy access and use. Now, we just need to tell Ubuntu to automatically start the array so it can mount it.

We’re almost done here, so don’t fret. If you’re still with me, you’re doing good!

Okay, so again, we’ll need to open up our good friend the Terminal. Just two steps in this one.

First we need to get some information on our RAID array, so run the following command.

sudo mdadm --detail --scan

This will give you something like

ARRAY /dev/md0 level=raid5 num-devices=3 metadata=01.02 name=:New RAID Array UUID=17bb603a:19899f73:1bfeb2f4:e1e88307

You’re going to need to copy all of this information. Now, once copied we’re going to open up a configuration file and paste it in. Easy peasy. So, run the following.

sudo gedit /etc/mdadm/mdadm.conf

Similarly, to when we edited the fstab this will open the mdadm.conf file in atext editor with root privlidges. Again, you can mess up your system if you mess around in here without the right know-how so leave things be.

Find the section towards the top that says

Device partitions

and immediately after this paste the information we got above. So, when all is said and done your file should look something like this:

DEVICE partitions
ARRAY /dev/md0 level=raid5 num-devices=3 metadata=01.02 name=:New RAID Array UUID=17bb603a:19899f73:1bfeb2f4:e1e88307

If so, great! Save and close it and go ahead and reboot your system to see if all your hard work has paid off.

Note: If you have any problems, revisit the steps above and see if anything might of been mis-configured. If you hosed your fstab and your system is no longer booting, you and Google will have to figure that out or you’ll need to do a reinstall Ubuntu (this isn’t necessary, you should just be able to load up a live image and edit your fstab).

Array Expansion

This is an optional step which covers expanding the array for if and when you decide you need to add some additional storage.

This is a fairly easy process, but it is not without its own risks. We will need to grow the file system at one point, and if you suffer a power outage or other catastrophic event during this process (or if it just for some reason messes up) you could loose all your data.

With that additional warning out of the way lets continue on.

Preparing the Array

Open up Disk Utility, navigate to your array and click on Unmount Volume. We will want the array unmounted while we work on it.

Now, we’ll need to launch the terminal and run a quick command that’ll prepare the array to be expanded.

sudo mdadm --grow /dev/md0 -b none

Note: You will need to replace md0 with the correct device number if you have more than one raid array! You can check this in Disk Utility under Device:.

Adding Another Disk

Now, if it’s not up already, launch the Disk Utility again, and navigate to your array. Verify that it’s still unmounted, then click on Edit Components and, you guessed it, Expand Array.

You will be presented with a list similar to the one we saw when we originally set up the RAID Array. Find the disk you want to add to the array, if none are available you will need to go up to the Setup section and repeat the setup process for the Disk in question (also note the warnings about loosing all the data on the disk again).

Select the disk you want to use to expand the array, check mark it, and hit the Expand button when you’re sure. You will likely be prompted for your password, and then returned to the main Disk Utility page where the array will be in a Recovering state. This is another process that can take hours or days. Once it is complete, we can move on to expanding the file system.

Once this is complete the array will be larger but the file system on top of the array will still be the same size.

Expanding the Filesystem

To expand the file system we will need to go back to the Terminal. Once there, we will need to check the file system and fix it if need be before we can expand it. If you followed my guide and used EXT4 this should be a quick process. If not, and are using EXT3 you may have a long wait in store for you. If you’re using a completely different file system, you will have to research how to do this on your own.

In the terminal run the following

sudo e2fsk -f /dev/md0

Again, if your raid array is not at md0 you will have to change this accordingly.

Once this is complete, we can proceed to growing the array (assuming there were no critical errors that were not repaired anyway).

Again, don’t run this next step if you have any doubts about the stability of your power or your system. This needs to be allowed to complete without interruption or you risk severe data loss!

Now, in the terminal run

sudo resize2fs /dev/md0

This, shouldn’t take all too long fortunately. Once it’s done, we need to undo the initial change we made to the array to allow us to expand it. This is undone by running

sudo mdadm --grow /dev/md0 -b internal

Once done, you can reboot or run

sudo mount -a

to automatically remount your raid array. Verify that it’s now approximately the size it should be (keeping in mind disk sizes are in base-10 and file systems are in base-16) and that’s it.

You should be good to enjoy your array once again with even more space to take advantage of.

Closing

There you are. If everything was setup right you should now have an awesome RAID 5 or 6 array to call your very own. Treat it right (keep it cool, use quality disks), keep an eye on it (run SMART tests or your drives, and keep an eye on Disk Utility), and you should have a nice setup for some time to come.

Remember, this is not a replacement for an offsite back-up!

I wrote this guide following a ton of research and hands on experience in an effort to try and find the easiest and most robust way to combine my drives into a single pool of storage. Stuff like LVM, RAID 1, RAID 6, unRAID, and other non-standard RAID solutions were considered, but ultimately RAID 5 seemed to offer the easiest and safest solution for my needs. Eventually I may step up to RAID 6 for added redundancy, but for the time being this is an improvement over my previous setup.

I hope this guide was helpful, if so hop on SpaceMonkeyNet.org and leave me a kind word, or tip me a buck or few.


I write my guides to improve my own technical and soft skills, but if I can get them to pay for themselves all the better!

Comments
24 Responses to “RAID 5 & 6 Install, Setup, & Configuration Guide for Ubuntu 10.04 LTS (Lucid Lynx)”
  1. IanK says:

    How would you recommend testing the array? I’d like to make sure it’s capable of recovering from a (staged) single hard disc failure. Could you also tell me how to restore it?

    • Anonymous says:

      Hi Ian,

      This is something I plan to add to my next revision of the guide. Simply shutting down the system and unplugging one of the drives should simulate a failure. From there use the Disk Utility to attempt a restoration. I haven’t played around with this yet so I can’t offer concise advice but I have little doubt it’s straight forward. A virtual machine could also be used for testing as well.

      Good luck!

  2. Anonymous says:

    Hey Ian,

    Yeah, if you’re wanting to fully restore the array swap out the old drive and swap in a blank one and then add it to the array and restore it.

    Take care,

  3. Jeremy Hannah says:

    Hello,

    Thank you for the excellent guide. I do have a couple of questions which I hope that you might be able to answer for me.

    Q1. At what point was Ubuntu installed?

    I have followed your guide to the point of formatting the volume. I saw in your comments that you made the following comment:

    “That’s right, if you format the array with a file system (Format Volume) you can begin to use the array now, however you will have zero redundancy, and even a single disk failure will cause you to loose ALL of the data on the array.”

    On page 4 of your guide you go onto format the volume using EXT4, so I am a little confused.

    I’m running an MSI K9N2GM/VM motherboard which has the ability to use the BIOS Raid 5, but following your guide plus a few other guides, I have turned the BIOS raid off.

    I’m primarily running the Ubuntu 10.10 live cd, but am going to try again with 10.04 this afternoon.

    The main problem I’m running into is that when I come to install Ubuntu, it complains about not being able to decipher the disk geometry.

    I would be very grateful for your guidance. Once again, a great guide!

    Many thanks in advance,

    Jeremy Hannah

    • Anonymous says:

      Hi Jeremy,

      The guide assumes you already have an Ubuntu or Linux Mint operating system installed on a different drive and are using the RAID 5/6 array for archival/storage purposes (not as a boot drive).

      I’m not sure what all problems you might run into with using this guide for a boot RAID 5/6 array as I’ve not tested or experimented with that. At very least you’d probably need to back-up your mdadm.conf file and import that into your new system.

      At least part of the reason for going with the software RAID 5/6 setup was so that it was independent of the operating system, using the RAID array as the OS boot disk seems to, at least partially, defeat this purpose.

      If you have any further questions please feel free to respond or email me directly, I’ll try to help out as best as I am able.

      Take care!
      daemox

      • John says:

        I am following your guide for Linux Mint and would like to setup the RAID 5 for my os. Could you tell me what steps I would need in order to successfully setup a raid 5 instance?

      • daemox says:

        Hi John,

        The steps should be very similar.

        I no longer run Linux Mint myself so I wont be able to give you a 1:1 guide.

        As stated in my guide this really isn’t a novice user’s topic, (especially if problems arise down the line).

        Best of luck to you though!

  4. Hal says:

    This was an awesome guide. Exactly what I had been looking for. I’ve been having some problems with the drives reporting that they are misaligned by XXXXXX (3072 bytes this time around) what gives? I have gone through this several times deleting the partitions on each drive and then reformatting the drives in GUID and recreating a RAID5. Can I ignore this, or what should I do different to start all over again.

    • Anonymous says:

      Hi Hal,

      Unfortunately, I’ve never ran into that issue so I’m unfamiliar with it. I’d recommend searching Google/Ubuntu/Linux Mint resources for answers. It may be related to your specific drives, or how they were partitioned. I honestly can’t say though.

      Best of luck!

      • Ozgur Gurtuna says:

        Hi there,

        Thank you for this fantastic guide. It was very useful for me. I had a similar issue with misalignment. In my case it was due to the 4096 byte sector size of my 3TB drives. I was able to resolve it by using GNU parted prior to setting up the RAID. I used these instructions: http://www.cyberciti.biz/tips/fdisk-unable-to-create-partition-greater-2tb.html

        I hope this helps.

      • daemox says:

        Hi Ozgur,

        I’m glad the guide worked out for you! Thanks for the note about the 3TB alignment as well. Unfortunately I haven’t gotten to play with 3TB drives yet so I’m currently unable to help with them. Happy you provided a link, cheers!

  5. Steve says:

    Hi :) This is not just an awesome guide. it’s absolutely amazing!! WOW! I’m quite new to Ubuntu and RAID and had absolutely no problem following the very simple but not over simplified steps and have now got 3x 2TB drives working in perfect harmony and auto-mounting at boot. I had Google’d for hours, trawling through complicated out of date guides that made me want to give up and shoot myself, and then I stumbled on this one. I would like to say a gigantic thank you to Daemox for all your time and effort on this guide, you deserve a huge pat on the back :) If anyone is reading this before they try and set up a RAID array and is unsure…don’t be, if I can do it then anyone can :)

  6. Steve says:

    Hi Daemox :)

    I have a quick question…I recently installed 3x 2TB WD Green HDD’s on an ASUS M4A88T Evo Board with Ubuntu 11.04 running off a 30GB SSD and a SATA DVD drive. The SSD and one of the WD’s are showing up under the SATA controller (Disk utility) and the other two WD’s are showing up under the PATA controller! As I wrote earlier, the RAID 5 seems to work fine (thanks to your excellent guide) but I just wondered if you knew any reason why the two drives show up on the PATA controller rather than the SATA? They all use SATA leads and I haven’t used any jumpers or anything else to change the drives! Would really appreciate any thoughts :)

    I have just read and used your XBMC guide too…eternally indebted ;)

    Steve

    • Anonymous says:

      Hi Steve,

      I was about to respond to your other comment but I’ll throw it all together here.

      Many thanks for the kind words, definitely appreciated. I’ve been a bit busy elsewhere recently, so this helps keep me motivated to keep my guides updated.

      As for the controller oddity, it may come down to how your motherboard’s north and south bridge are setup. The two WD SATA drives may be going through a make shift SATA connection that uses the PATA chip on the south bridge to add a couple extra ports to the mother board.

      If you’re worried you could use the benchmark utility in Disk Utility to see if there’s any performance impact on those two drives.

      Anyway, I hope Ubuntu/Linux works out for you, and thanks again for the comments on my guides.

      Best of luck and take care,

      • Steve says:

        Hi, I’m back again ;)
        After running my raid 5 array for a while on Ubuntu now I have encountered a whole heap of problems and have decided to give Suse 11 a go. I can see the three 2TB HDD’s and Suse tells me that they were in a Linux Raid, but I’m really unsure of how to re-assemble the array on Suse. The “Expert Paartitioner” seems like the right tool, but I don’t want to go in like a bull in a china shop and lose all the data on the array. Could you possibly point me in the right direction please :) Thanks in advance for any help or advice. Steve

      • Steve says:

        Hi, I’m back again ;)
        After running my raid 5 array for a while on Ubuntu now I have encountered a whole heap of problems and have decided to give Suse 11 a go. I can see the three 2TB HDD’s and Suse tells me that they were in a Linux Raid, but I’m really unsure of how to re-assemble the array on Suse. The “Expert Paartitioner” seems like the right tool, but I don’t want to go in like a bull in a china shop and lose all the data on the array. Could you possibly point me in the right direction please :) Thanks in advance for any help or advice. Steve

      • Anonymous says:

        Hi again Steve!

        Unfortunately, I have zero experience with RAID on SUSE. I haven’t even fired up a SUSE install in years. In Ubuntu 11.04 all that needs to be done now is to install mdadm and reboot. From there, the array will auto initialize and can be mounted manually or fstab can be edited to auto-mount it.

        Sorry to hear you were having issues, but not sure if a distro hop is the best solution for you.

        Cheers, and feel free to bounce ideas off me here or via email!

Trackbacks
Check out what others are saying...
  1. [...] This post was mentioned on Twitter by Rene Nachtnebel ✔ and Joe Hermando, daemox. daemox said: RAID 5 & 6 Install, Setup, & Configuration Guide for Ubuntu 10.04 LTS (Lucid Lynx) http://goo.gl/fb/nOPtn [...]

  2. [...] note, I have been waiting to write my upcoming Couch Potato guide, as well as waiting to update my RAID and SABnzbd+ guides (at very least) until Linux Mint 11 reaches release candidate or final status. [...]

  3. [...] year, and it will join the ranks of my other major guides (SABnzbd+, Sick Beard, XBMC Media Center, RAID 5/6) in being regularly maintained and updated (generally [...]



Leave A Comment

 







Hey! You! Enthusiastic Ainer.org reader! Are you noticing lots of blank space above this text and elsewhere on the site? Consider then, adding www.ainer.org to your adblock plugin's whitelisted domains! This site depends soley on ad revenue, affiliate links, and donations to pay for hosting and upkeep. If you find our ads obtrusive please let us know! Thanks for your continued support! Cheers!

QR Code Business Card