My end goal is that I want a samba share that displays all of the folders across several disks as one unified, read-only folder. This is for a NAS/media server setup.

Is there a way to create a unified folder that contains all of the subfolders of each of these drives in this way?

  • I guess you could do that with symlinks, but what's supposed to happen if you have a subdir /foo on more than one disk? – Ulrich Schwarz Jun 6 '13 at 6:05

You can use a union file system like aufs on Linux:

set /disk1 /disk2 /disk3
mount -t aufs -o br"$(printf ':%s=ro' "$@")" aufs /union/disk

(if files are common between the disks, the one from disk1 takes precedence)

  • out of interest, would this work for a non-readonly folder? – muzzamo Jun 7 '13 at 1:20
  • @MurrayWaters, yes, the typical usage of aufs is to make a read-only directory writable by layering a writable one on top of it (think of instance of a live CD which you can modify by writing the new files on a RAM FS). See the aufs man page for all the possibilities. – Stéphane Chazelas Jun 7 '13 at 7:22

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.