I have just spent in excess of 200 hours trying to get intel ICH type Raid (controlled partly in the intel ICH BIOS) to work with Ubuntu. Luckily I didn’t gnaw all my fingers off in frustration, so I felt I had a duty to write it up in the hope of saving some other poor soul the nightmare I had. These are instructions based on my dual boot Ubuntu 12.10 and Windows 7 x64 setup, though I expect they will be very useful for anyone trying to get this working. You could go all software raid, but why not have the best of both worlds?
Before I start I would like to point out a few interesting observations:
- Currently in Ubuntu 12.10 mdadm is started after the OS uses FSTAB to mount the drives, resulting in Ubuntu not being able to mount your valid array. This is why I have written this guide. I consider this a bug.
- Ubuntu 12.10 uses mdadm version > 3.2. This is very important as post 3.2 supports imsm (Intel chipset raid) metadata properly.
- Ubuntu pre 12.10 I cannot vouch for and previously I had to go software raid, but you could compile mdadm from source.
- MDRAID (mdadm) has absolutely appalling documentation. Getting this working took me to have about 20 different how-to’s open at once. Most sources of information contradict each other in some small way, leading to confusion. There are often 2 ways to do the same thing. If ever something needed a manual, it’s this (I don’t consider The Manual to be a proper manual!)
- Currently in Ubuntu 12.10, on reboot, your assembly is lost and you have to scan and assemble again. I had to hack a workaround for this. Even outputting the scan result to mdadm.conf is not enough to allow it to find stuff on boot.
- You don’t need to worry about the raid initialising and can continue to make changes and reboot safely.
- I cannot comment on DMRAID as, according to Intel, you should use mdadm as dmraid is not developed actively.
- Using this method you can access the array in both Windows 7 and Ubuntu.
- mdadm installs postfix for mail – don’t be spooked by this, it is just a choice of the developer and you don’t need to use it.
- I am a programmer, not a linux expert: if anyone wants to be a smart ass about my method, fine by me, flame away!
- sudo gedit will allow you to edit things like fstab, mdadm.conf, rc.local etc.
- I take no responsibility for your RAID collapsing, computer catching fire, etc.
I will list my mdadm.conf and rc.local at the end for you to look at. Here are the steps I took to get it all working:
- First of all set up the raid volume in the Intel RAID BIOS by booting and pressing CTRL + I (sometimes K or L). The volume name should have no spaces. I went with a RAID 5 array with 5 members of 1TB each.
- If you are doing this at install time, install Ubuntu 12.10 from a live CD/USB and install gparted. There will be a link on the desktop to install Ubuntu once it boots up. You can get gparted from the software centre. kpartx already seems to be installed. Install to the device and not a particular partition. Make sure you selected to format any existing partitions that need wiping at this time as well (from the advanced options in install in the GUI). Reboot!
- Launch a terminal and: ‘sudo apt-get remove dmraid‘ then ‘sudo apt-get install mdadm’ to replace the shipped dmraid with mdraid. Install gparted as well from the Ubuntu Software Centre. Keep this terminal open for the rest of the steps.
- At this point change to root user so that you are not constantly typing sudo, type ‘sudo -i‘ (when done you can type ‘exit’).
- Assemble the array with a simple ‘mdadm –assemble –scan‘. You might also want to check it has worked using ‘cat /proc/mdstat’. You should see your array as something like md126 and it is probably re-syncing. At this stage if you don’t have a Raid array then something has gone wrong: send me a bullet in the post!
- If you launch the disk utility from dashboard you should see your new raid array. Note where it is (e.g. dev/md126) as we will need this for the mount point. Also, you may as well format it now from the disk utility, as it means we can specify the file system for mount in the script we are about to alter in rc.local.
- Next we need to set mdadm.conf: ‘mdadm -E -s –config=mdadm.conf >> /etc/mdadm/mdadm.conf‘ (see intel paper).
- Unfortunately this will not survive a boot even with ’update-initramfs -u‘, so we will need to add something to the boot process to make sure Ubuntu finds our array. From your still open terminal ‘gedit /etc/rc.local‘ and add the lines: ‘mdadm –assemble –scan‘ and ‘mount -t ext4 /dev/md126 /store‘ to the file before the ‘exit 0‘. Obviously you will want to replace ‘ext4‘ with your file system, ‘/dev/md126‘ with the name found in step 6 above, and ‘/store‘ with the location of your mount point. I just created /store in the root file system. This should now start up your array and mount it on boot.
- Now is the time to type ‘exit’ in your terminal to return you to you… um… you know what I mean! If you are getting errors about permissions then maybe you missed the underlined bit in 4 above?
- As a final step you should install samba, launch it and set it up if you want to share the mounted volume with other windows computers. Also, you may want to edit the permissions (chmod/chown) of the mount point. I simply sudo launched nautilus and did it that way (‘sudo nautilus’ from a terminal). Check your share is there first at this point before rebooting. You may also want to install Ext2Fsd on the windows dual boot system so it can see the volume (or you could have set it up using ntfs3g anyway).
- Reboot and pray!
NB: I can’t work formatting in WordPress to get a mono spaced font for the code. Note the use of double hyphens – cut and paste if you have trouble reading it, sorry about that!
I think I have included every step I used here, but am happy to answer any questions you have. Click for rc.local and mdadm.conf and Intel’s Linux Raid Paper. You may also find this cheat sheet helpful. The Ubuntu forums have lots of disaster stories on trying to get Intel raid working too, but it is important to make sure the information is relevant to Ubuntu 12.10.
I found this whole thing a total nightmare and I wish someone with better editing skills than me could do a good article on it. Good luck!
EDIT: Ubuntu would not shut down after this, so you will also need to add a shutdown script that unmounts, then stops the raid. Here are the commands and here is the script. You will need to adjust depending on where your raid is (i.e. it might well not be md126).
EDIT 2: Here is the pdf that I reference from Intel. It seems not to be available any more: