Latest LQ Deal: Latest LQ Deals
Go Back > Linux Answers > Hardware
User Name


By MattOlz at 2005-12-09 17:55
Once I bought a second hard drive, I decided it was time to try out raid. I found searching around that most of the tutorials on setting up raid was either for old linux versions, for hardware raid, or for raid1 (mirroring). The closest how-to I could find was for a Slackware 8.1 system at - which is what this tutorial is mostly based on. I tried the methods described numerous times, and nothing prevailed. Finally, I winged it and tried the steps described in this tutorial.

1. I use 2 Maxtor 120 gig hds. Start off by partitioning your first drive drive using whatever is your preference:
A. You need 1 boot partition, type 83 (Linux) and mark it bootable. I made this 30mb.
B. Next partition you need is your swap, type 82 (Linux Swap), I made mine 350mb. Make this half the size you need. (I wanted a 700 mb swap.)
C. Set the rest of your drive as type FD (Linux Raid Autodetect).

2. On the second hd:
A. Set a partition equal to your boot partition and type it 83.
B. Set the second partition equal to the swap on the first.
C. Set the rest of your hard drive as FD.

So, I Have the following setup:

/dev/sda1 30mb 83
/dev/sda2 350mb 82
/dev/sda3 119.62gb fd
/dev/sdb1 30mb 83
/dev/sdb2 350mb 82
/dev/sdb3 119.62gb fd

Reboot to make sure everything is set right. Ignore any warnings that the sdb does not have a partition marked bootable.

Once you are back in the shell, make sure /dev/md0 exists: ls -l /dev/md0 . Output like the following is good:
brw-rw---- 1 root disk 9, 0 1998-04-02 01:37 /dev/md0
If not: mknod /dev/md0 b 9 0

Next you need to create a raidtab file, which basically tells the system all about your raid setup:

raiddev /dev/md0 #use the device /dev/md0
nr-raid-disks 2 #How many disks you want to use in the array.
nr-spare-disks 0 #Number of spare disks for reconstruction(not used in r0)
chunk-size 16 #How big you want each stripe (in kb)
persistent-superblock 1 #Puts array info on the superblock of each drive
raid-level 0 # Self-explanatory
device /dev/sda3 #First partition to use
raid-disk 0 #Remember arrays start at 0
device /dev/sdb3 #Second partition to use
raid-disk 1

Next build the array: mkraid /dev/md0 . If you get an error about it already existing, then tag a --force on it and read the spiel and warnings, then do as it says.

We have to then format this partition ourselves, since there are some special options needed: mke2fs -jb 4096 -R stride=4 /dev/md0 . /dev/md0 will be formatted ext3 with a 4kb block size . The stride is your chunk size divided by the block size.

Now you are ready to enter the setup. Once there, setup swap as usual, then add the partion /dev/md0 w/ no formatting as /, /dev/sda1 as /boot formatted to your preference, and /dev/sdb1 as whatever you want, formatted to your preference.

Install the software, and then install lilo to mbr (/boot).

When setup is done, DON'T REBOOT!

First we need to copy over the raidtab info to the drive: cp /etc/raidtab /mnt/etc/raidtab

Then check your /mnt/etc/fstab to make sure it has /dev/md0 and /dev/sda1 and /dev/sdb1 in it.

Lastly edit /mnt/etc/lilo.conf and set root = /dev/md0 . Run lilo -C /mnt/etc/lilo.conf to reinstall, and you are done. Reboot and your new system should now be working.

by vonst on Sun, 2006-05-21 09:52
This article is great! However, I tried this mini-HOWTO right out of the box and it failed miserably. In order to install with the options of SATA and RAID, you have to use the "sata.i" kernel. On loading, I would get a warning and error that the superblock was invalid:

md: invalid raid superblock on...
I could generate the array; I could format the array; I could install Linux into the array; I could not get the array to come back to me on reboot! I would then restart Linux with the install disks, regenerate the array, and find my install sitting there fat, dumb, and happy.


It took me two months to find this solution and I took it right out of the old Software-RAID-HOWTO. md was doing the complaining. Eventually, I found that mdadm administers md. The Software-RAID-HOWTO (Sect 2.4) says that you don't need mdadm. However, if you are experiencing the same problem with generating a persistent superblock that I did, mdadm is a must.

mdadm is not in your Slackware installer disks. You may be able to copy it into your RAM OS after you load up sata.i, but I did not do that. I actually just about gave up on RAID and completely installed Slackware onto a single partition. At that point, I discovered mdadm and ran a single command that I learned from the Software-RAID-HOWTO (Sect 5.4). It suceeded nicely, just like mkraid suceeded nicely. However, on reboot, all the errors went away and from then on, it finds and installs the /dev/md0 that I asked for when I ran the command. Oddly, I seem (for now) to have no need to keep a raidtab file at all. I generated one, just in case. Anyway, here's the command that saved my sanity:

mdadm --create --verbose /dev/md0 --level=raid0 --raid-devices=3 /dev/sdb2 /dev/sdc2 /dev/sdd2
I hope this helps everybody else!


Note: This post is an edit of a plea from 2 months earlier to help me solve the problem of the non-persistent superblocks.

by eRJe on Thu, 2006-10-05 12:07
I'm trying to setup a raid (jbod) config. I've been going through a lot of tutorials but basically there all the same. I always get stuck somewere along the way. I have 2 SATA drives which I want to combine to one drive. On a 3rd drive I have my slackware distribution 11 kernel 2.6.18 installed.

I have tried so far:

mdadm --create --verbose /dev/md0 --level=linear --raid-devices=2 /dev/sda1 /dev/sdb1
but getting the error message: mdadm: error opening /dev/md0: No such file or directory
then I tried creating md0 by doing: mknod /dev/md0 b 9 0
but after: mkraid /dev/md0 I get the error message: cannot determine md version: 6.

Does anyone know how to proceed?

Any help is much appreciated!


by vonst on Thu, 2006-10-05 13:58
This thread was meant to discuss the article. Granted, the article is general and cannot meet all needs. You've got one of those big problems that the forums were meant to help with.

Could you bump this post out to the Slackware forum so that me and the other Slackware RAID guys can better understand your setup and errors and help you out there?

After we fix your problem, assuming we can fix your problem, you can post your solution back on this thread like I did.

-- vonSt

by Furlinastis on Tue, 2006-10-24 23:58
I hope I'm not overstepping my bounds by posting here, but I finally installed raid with slackware, but I used a gentoo liveCD to set up raid with mdadm. There's no need for a /etc/raidtab file or anything with mdadm, just run the command and format and install slack. I would suggest that someone put mdadm into the install disc of slackware.

My drives are like so: (in case this helps anyone)
/dev/md2 / raid1 256MB /dev/hd(a,b)2
/dev/md1 /boot raid1 38MB /dev/hd(a,b)1
/dev/md3 /usr raid0 5.7GB /dev/hd(a,b)3
/dev/md4 /opt raid0 5.7GB /dev/hd(a,b)6
/dev/md5 /home raid0 98GB /dev/hd(a,b)7

All partitions were done with ext3.

I used this tutorial as well:


All times are GMT -5. The time now is 01:19 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration