1

Is it possible to allow all hard drives to be used/listed as a single mount point in a Linux file system, but still remain independent of each other to a point of if one drive was disconnected all the remaining drives will function and the OS will just not show the data that was on that drive?

Furthermore if this setup is possible would it also be possible to use that disconnected hard drive in another system and mount it to access its data?

I've been reading on different ways of working with hard drives, but nothing seems to cover this scenario. Raid creates one volume, but if a drive is lost or is not rebuilt the data is lost. LVM also creates one volume, but it seems that the hot swapable nature of my question can not be achieved.

The nature of this question is for a media server in which I can remove drives and insert them into other computers to mount them/work on data, then insert it back into the server. It should also be that if I add a new drive I should be able to assign it to a specific mount point for saving data.

For instance say I have /dev/sda and /dev/sdb mounted as /books and /movies. If I needed more space for /movies I would want to add a new drive /dev/sdc and have the added space be allocated to /movies in a way so that data is written to which ever drive has enough space for the entire file. Then if I wanted to move /dev/sdb to another computer I could eject it/mount it in another computer while the movies that are still on /dev/sdc should still be accessible in /movies

Is such a configuration even possible?

Thanks

0

The short answer is "look into mhddfs" - it is a virtual filesystem which claims to allow you to merge drives together in exactly the way you contemplate. It looks like it has a limitation in as much as it picks the first drive with enough space for the file. There are other ways arround this problem, but they create their own problems.

I note that RAID can not figure into the answer as RAID creates disk dependencies and operates at the block device level. Your solutions need to reside at the filesystem level - because you want to be able to read the disks elsewhere and independently, meaning that each disk needs to have a filesystem on it.

The rest of this answer may be interesting if mhddfs does not meet your requirements (or you can't get it to work) - The answers are only partial, as I stumbled across the full answer while researching the second partial answer. They provide interesting alternatives which are better known and accepted.

Which leads to the 2 partial solutions:

  1. Use symlinks. Lets say you have 3 disks, each with a single partition with an EXT4 filesystem (filesystem type is probably not that important). The disks are /dev/sda1 /dev/sdb1 and /dev/sdc1

You could (for example) create mounts like

/dev/sda1 /media/disk1 
/dev/sdb1 /media/disk2 
/dev/sdc1 /media/disk3

For this example you will want to create subdirectories, for example

 mkdir /media/disk1/books
 mkdir /media/disk2/movies/drama
 mkdir /media/disk2/books/old
 mkdir /media/disk3/movies/scifi

You will also want to set up directories on your "target space", so /data/books; /data/movies; /data/movies/drama; /data/movies/scifi

And then under /data create symlinks to the appropriate parts of the disk, eg

ln -s /dev/disk1 /data/books
ln -s /dev/disk2 /data/books/old
ln -s /dev/disk2/drama /data/movies/drama
ln -s /dev/disk3/scifi /data/movies/scifi

In this way, provided you still have an organised hierachy of space you can symlink stuff as you need it. You can, in this way spread the information out over multiple disks and have it appear as one.

The other solution is to use some kind of overlay filesystem. This allows you to combine multiple systems into a single larger system using priorities. Different distros have different versions of this, with different syntaxes. The common variants are good at reading aufs, overlayfs, unionfs. These are, however, generally good for reading but not so good for writing, as they will generally only allow writing to a single place at a time.

| improve this answer | |

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.