5

Disclaimer: This is probably crazy from a performance point of view, also from a reliability point of view, and maybe only of academical value (as in: would it work at all?). That being said:

Will mdadm support a RAID setup with its individual redundant disks being network drives?

Here's the background of my (crazy?) idea: I would like to use one linux box with just a small disk to hold the system. Connected to this box, via ethernet, are two other machines, each with a RAID-0 system to get some use out of old-ish hard drives. Both RAID-0 volumes are built to have approximately the same size. Now, each of these machines offer the RAID-0 volume as a network share, and the box mounts them as /old_drives_0 and /old_drives_1, respectively.

On top of that, I would like to tell mdadm on box to build a RAID-1 system using /old_drives_0 and /old_drives_1 as the two mirrored "disks" and offer the such-created RAID-1 volume on the network as a drive.

Can I tell mdadm to use just about any mount point (and not the usual /dev/sdaX), as in:

mdadm /dev/md0 --create --raid-devices=2 --level=1 /old_drives_1 /old_drives_2
mkfs /dev/md0 # optionally specifying -text3 or -text4
mount /dev/md0 /raid

(loosely quoting https://unix.stackexchange.com/a/48437/27804)

I know there are many reasons not to build a raid over the network, but there may also be reasons in favor of it: Once a disk breaks, all I have to do is hook up a network cable to a different machine... Also, when I put three NICs in box, it can access its own two RAID "drives" over dedicated ethernet connections and use the third for upstream traffic for access to the RAID-1 volume from its clients.

I could even keep around one "box" and one "machine" as a drop-in replacement which would allow quick maintenance once something fails.

6

RAID always needs a device (at least if you use md). There are two ways. The probably better one is to use a network block device:

https://en.wikipedia.org/wiki/Network_block_device

You can tell md to use such a device for writing only (because it's too slow for reading) with mdadm ... --write-mostly.

The other option is to create a file on a network volume (file system level) and use it for a loop device.

  • 2
    NBD is the better option for this use case, since its protocol has less overhead than NFS (which needs to deal with concurrent access locking, caching, etc, that is irrelevant for the layer that NBD and md operate in). Disclaimer: I do maintain the NBD userland tools. – Wouter Verhelst Jan 20 '16 at 1:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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