Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to create a RAID-1 array with Debian 6. This array will contain 6 disks, 3 for the OS and 3 mirrors.

I used this RAID before but on windows, and maybe I didn't do it good at all, because I could see 3 different disks, but only one for the OS. Is there a way that the OS will see the 3 disks like one ? or they will be like different units?

share|improve this question

From what I understand you created 3 raid arrays, each with a mirror attached. You can mount each "half" of the pairs as normal disks but it's not advised while the array is running and both "halves" are active as that will desyncronize the copies and breaking the array. But in case of a failure they are there separately, and also if you use it for directories like /boot any processes that don't understand raid natively will just see them as identical copies, I use a small partition with raid-1 with many drives to ensure that the machine stays bootable no matter which OS drive dies.

Though this besides the basic hardware redundancy this has no benefit, and requires extra maintenance (3 arrays to take care of), and the drives are isolated.

If you're doing this for performance reasons and you want the most IOPS (e.g. for a database server) you're better off with a raid 1+0. This would be basically a stripe of 3 drives (roughly 3 times the read/write speed of a single disk) and a mirror of this array with another 3 drives. Current MD drivers support this natively and you don't need to manage the raid-1 and raid-0 arrays separately, but create a single raid device:

mdadm --create /dev/md0 -v --raid-devices=6 --level=raid10 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1

This means you get a total array size of the sum of 3 disks. The problem with this setup is that the failure of 2 drives can destroy all your data if it is the same drive mirror "halves" in the 2 copies. The drives are probably of the same age which means they start to fail around the same time. And the stress of a rebuild on the other "half" increases the chance of failure significantly:

With your setup the data loss survival probability looks like this with raid-1+0:

1 drive fail  = 100%
2 drives fail =  80%
3 drives fail =  40%
4 drives fail =   0%

If you're ok with balanced IOPS/speeds and storage capacity with 6 disks you get way better resilience if you create a raid-6 of all the devices:

Probability of data loss in a 3 year span:
RAID5  - 0.0125 % (1 in 80)
RAID6  - 0.0005 % (1 in 1982)

But since you need a boot partition (the boot loader cannot be striped across the disks) you need 2 arrays, one small one lets say 256Mb and the rest together, you should create this scheme with fdisk or cfdisk and make sure that the bootable flags are set for the small array. You can copy the partition table from one disk to the other with sfdisk if the drives are exactly the same size:

sfdisk -d /dev/sda | sfdisk /dev/sdb

Then create the 2 arrays:

mdadm --create /dev/md0 -v --raid-devices=6 --level=mirror /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1
mdadm --create /dev/md1 -v --raid-devices=6 --level=raid6 /dev/sda2 /dev/sdb2 /dev/sdc3 /dev/sdd4 /dev/sde5 /dev/sdf6

The OS installers can take care of this for you though just make sure to mark the first array to be used for /boot

With this you win back 1 drive worth of storage (total capacity = drive capacity * 4) The array can survive the failure of 2 drives, and if they are not at the same time, you have more than enough time and mathematical chance to rebuild this array.

One thing to keep in mind is with current consumer quality (read error rates of ~10^14/error) and drive sizes (>=2Tb) you should never use raid-5 for critical data, as the chance of rebuilding this array in case of a failure is less than 50%.

share|improve this answer
I havent mount the 3 drives, I am thinking, honestly if is better idea to use only 2 hard disk i would use it... u think the raid u mention is better? or is better to use only 2 hard disks? – jpganz18 Jan 26 '13 at 0:49
@jpganz18 What do you plan to use the machine for? Is it as server or a workstation? Do you run a high traffic database or file server? Do you store mostly large files? (10Gb+) I can suggest other schemes that might work better but I need more info. – psarossy Jan 26 '13 at 0:57
Thank you @Peter , well, the server will host an application, about 40 users, will generate files and all... I have an estimate that the only big file will the database, and will grow like 2GB per year... not so much, only for that, unfortunately, the server were I am supposed to install it has already this configuration, and has 6 hard disk of 60GB each one... (its kinda old), I want to configure it at the best way possible using all the resources... any idea according your experience and knowledge? – jpganz18 Jan 28 '13 at 1:46
@jpganz18 Since you mentioned that the server is kinda old, IO load will not be your biggest concern with this server as there's relatively low user load as well. The raid1+raid6 solution I recommended above is probably the safest/most efficient way. That way you're safe up till 2 drives if they go south. You could split it up with more arrays but they don't really offer you anything extra. If you would end up needing more IO for the database and want to keep everything as is, then you could make a raid1 w/ 2 drives for the OS and a raid10 for the database/user content on the remaining 4. – psarossy Jan 28 '13 at 7:52
I think you ought to clarify RAID6 performance. Non-degraded read is very good (assuming you don't verify parity, which I believe is true in mdraid), probably even better than raid10. Degraded sequential read is OK. Degraded random read is slow. Sequential write is OK. Random write is terrible. – derobert Jan 28 '13 at 20:25

Something here doesn't make sense.

A RAID1 array consists of 2 or more disks, all of which have the same contents. So if you make a 6-disk RAID1 array, you have five mirrors, not three.

You may mean make three RAID1 arrays, each consisting of two disks. Then you'll have three different md devices to access. This won't hide the disks /dev/sd[a-f], but you generally won't access the data on them directly when they're part of a RAID array. (You still access them directly for things like smartctl.)

You could also make a 6-disk RAID10 array, which would give you a single md device for all six disks, and would effectively have three mirrors. It'd also be faster.

The Debian Installer can set all of these up for you (I'm pretty sure it knows about RAID10, if not you'll have to switch to alt-f2 and use mdadm directly to create RAID10).

Normally you run Linux software RAID on partitions, not entire disks. Also, if you use a RAID level other than 1, I recommend making two partitions: a small 256MB one on each disk, RAID1, for /boot, and then a second partition containing the rest of the disk, at whatever RAID level you'd like. GRUB2 has pretty good support for RAID1, not so much for anything else. So /boot is usually best as RAID1.

Note that if you have on-board RAID in the BIOS, its probably fakeraid, and you should use Linux software RAID instead—at least if this is a new install and the machine is going to be Linux-only. You should configure the BIOS to run in AHCI mode, not RAID mode.

(If you spent $400+ on a actual hardware RAID controller, check its documentation for how to configure it. It will probably hide the disks behind it, and only expose the volumes you export.)

share|improve this answer
Thank you, well, I have a server with 6 hard disks, so, I was planning to use the 6, 3 mirrow of the other 3, but I want the 3 ones to be shown as only one, in y our opinion which RAID is the best? – jpganz18 Jan 25 '13 at 19:17
@jpganz18 It depends on what you're using the server for. Different RAID levels have different tradeoffs. Can you describe what you're planning on using it for? (In another question, possibly). – derobert Jan 25 '13 at 19:21
thanks, well, its just a simple application, with a database that could become a little big (about 50 GB) in some years, but they got a server with 6 disks, so, I am thinking about use them all... any idea? – jpganz18 Jan 25 '13 at 20:45
@jpganz18 I'd suggest RAID10, might as well use them for speed. You'd wind up with one volume from RAID10, which you can use LVM to split. (Do create the separate partitions & array for /boot). Depending on DB & expected write load, you may want to devote 2 of the disks (separate raid1) just for database redo logs. – derobert Jan 25 '13 at 20:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.