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).
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,
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.
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
And, the location of the RAID array itself should be like
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.
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
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).
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
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.
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!