Super User is a question and answer site for computer enthusiasts and power users. 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

Edited to reflect conclusions from comments:

I want to construct a software RAID-like array with 2 storage devices plus one parity device, where the parity device maintains the XOR of the two other devices.

This is reminiscent of a RAID3 or RAID4, except that I'd like to be able to mount both underlying devices and write to them as I normally would, with the XOR being updated with each write to the devices. This also means that I do not want my data striped.

In summary, I want an arrangement which lets me freely store data two mounted devices, and a third device that has an up-to-date XOR of those two devices.

Standard Linux RAID4/mdadm will not work for me because it (1) stripes files across disks (2) prevents the mounting of individual disks.

share|improve this question
If you wrote an implementation that allowed you to directly write to the underlying disk, it wouldn't be RAID4, because you are effectively corrupting the array. The md device is what allows RAID to happen - if you bypass it, you aren't using RAID. – Paul Jun 18 '13 at 13:33
What do you want to achieve? From your question it seems that you want to achieve something that is either impossible or is of no good for your data. – Uwe Plonus Jun 18 '13 at 13:37
I want to construct an array such that for every write on one disk of my choosing, the parity gets updated on another disk. – eitan27 Jun 18 '13 at 13:38
That is exactly what you have done. When you write to /dev/md0 it will write the data to the first two disks in a stripe, and parity to the last. – Paul Jun 18 '13 at 13:41
@Paul Okay, so here is the crux of the issue: I have certain files which I want stored on a specific device. Writing to /dev/md0 does not give me the freedom to choose which device a given file is stored on. Not only that, the file will be striped, meaning fragments of the file will be on different devices. – eitan27 Jun 18 '13 at 13:48
up vote 1 down vote accepted

You cannot. The only standard form of RAID that does not do striping, is RAID-1, a straight mirror.

It is possible that EMCs RAID-S does what you want, but this is a proprietary solution implemented in EMCs hardware (no longer used).

So yes, you'll have to write your own. Note though, that there will always be a pseudo device between you and the physical media. This is because to ensure integrity is maintained, a write to a disk, plus the write to the parity disk, must be considered atomic - ie, either both happen or neither.

So in this case, you cannot just write to the physical media, and have the raid system somehow detect this and calculate parity after the event. If this were possible, then if the parity writing part was interrupted, it would be impossible to know if the data was corrupted or not. Ie, is the parity different because the parity didn't get written, or is the parity different because the data on the disk is corrupted.

share|improve this answer

UNRAID may be what you need. They have a free version for 3 disks (2data/1parity). The system boot/run from a USB pen. The great thing about it is that on reads only the disk with the files being accessed spins up, and on writes only the disk being written to and the party disk spins up. You can find more info at here. The wiki has some outdated info so be careful. But the forum is quite active and the community seems quite friendly.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .