Linux – Can we mount multiple disks as one directory

linuxmountpartitionraid

Is there a way to mount the different disks as one directory?
Assuming I have some disks with ext4 partitions:

/dev/sda1 1Tb  mounted as /store1
/dev/sda2 2Tb  mounted as /store2
/dev/sdb1 2Tb  mounted as /store3
/dev/sdb2 2Tb  mounted as /store4

I would like to have /storeall with 7Tb space, merging them as one logical directory, so I can fill that with one rsync command.

Is it possible on Linux? Which filesystem should I use?

Best Answer

mhddfs is exactly what you are looking for: http://romanrm.net/mhddfs

You can mount like this:

mhddfs /mnt/a/,/mnt/b/,/mnt/c/ /storeall/

where /mnt/a/, /mnt/b/, and /mnt/c/ are three different mount points which can be from three different hard drives. You can unmount like this:

fusermount -u /storeall

If one disk fails you only lose the files that was stored on that particular disk. If your data is important for you and you would like your data to survive a disk failure you should consider a RAID setup instead (search for mdadm).

edit: PS! The devices you mount can even have different filesystems!

Related Topic