Mounting a disk image split up into two files

disk-imagemount

If I had a four gigabyte disk image, and I copied the first, say, two gigs, into a file at one path, and the remaining two gigs into a file at a different path, could I mount it as one disk image on one mount point despite half being in one file and the other half being in another file? Or if that's not possible if I had one disk image with one, say, ext4 partition and another with the same partition table and ext4 partition, would I be able to mount them on the same mount point? Methods that require FUSE will work for me.

Best Answer

You can mount two filesystems on a single mount point and there are actually a few ways of doing this and almost all live CD distros use them. But first you have to decide how you want to handle writes. If you need both filesystems to be merged and appear as one with all the files from both systems available but the writes going to only one of the filesystems then you can use overlayfs https://en.m.wikipedia.org/wiki/OverlayFS, unionfs or aufs

If however you need all of the filesystems to be read-write enabled you can have a look at mhddfs http://svn.uvw.ru/mhddfs/trunk/README

Related Question