There should be a filesystem which will unite (merge) any number of specified directories. One (specified by a mount option) of these several directories will be written when the merged FS is written. For example we could merge /mnt/disk1, /mnt/disk2, /mnt/disk3 together. If a file x/y is requested, it could check first /mnt/disk1/x/y or if file doesn't exist then /mnt/disk2/x/y or if file doesn't exist then /mnt/disk3/x/y. Writes could be redirected for example to /mnt/disk2.
It is unclear what to do if it is requested removal of a file which is present not only in the directory specified as writable but also in other merged directories. Probably should return EPERM or EACCESS error? Or should be removed from /mnt/disk2 (for example) but not disappear from directory listing? Choice between these two variants by mount option? Discuss here.
Eric says: -- You missed a few other options here. You could allow the non-writable files to be 'deleted', simulating their deletion in the union without actually removing them from the non-writable systems. You could mandate that all files present in the non-writable fs' have permission read-only. You could even have all files that are different in different file systems be visible in all versions, via renaming ("readme.txt.FILESYSTEM1, readme.txt.FILESYSTEM2..."), though that would be fairly painful to mount initially.
It depends on the application which is best, but for the sake of emulating a single filesystem, I vote for my first option - delete from the writable system and note it's deletion, simulating deletion from the non-writable ones as well. This makes the result indistinguishable from that you would get with a conventional file system.
По русски требуется более простой вариант.
Есть /path/dir1 и /another-path/dir2, хочется /mypath/dir3, в которой юудет одновременно контент первых двух директорий в режиме только для чтения.
С записью и удалением не очень ясно всё, поэтому только read only.