I'll be running it on Debian (lenny) and for now I'm just working with the union idea in a test VM. The PXE and NFS stuff will come after I prove that this can reasonably work.
I'm working with unionfs-fuse but I'm also open to funionfs. I looked at aufs but I think it's more complexity than we need. I'm pretty sure I've got the basic idea here but it doesn't seem to be working so I could be wrong in my understanding.
I've got test directories set up at /var/tmp/testdir1 and /var/tmp/testdir2. Each directory has 3 plain text files in it (test1-test3 and test4-test6 ; I'm so creative). I'm trying to mount those directories as read-only (ie nothing would write directly to either directory) to /mnt/union, with /mnt/union being a rw filesystem and where the copy-on-write would occur (ie all writes and changes would occur in /mnt/union).
So I do:
unionfs-fuse /var/tmp/testdir1=ro:/var/tmp/testdir2=r
I don't get any errors, looks successful,
debian:/mnt# mount
/dev/hda1 on / type ext3 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
/dev/hda9 on /home type ext3 (rw)
/dev/hda8 on /tmp type ext3 (rw)
/dev/hda5 on /usr type ext3 (rw)
/dev/hda6 on /var type ext3 (rw)
unionfs-fuse on /mnt/union type fuse.unionfs-fuse (rw,nosuid,nodev,allow_other,default_per
Looks good there too. Can't find anything related to mount/filesystems/fuse/etc in logs, moving on.
I run # ls /mnt/union, expecting to see files test1-test6 (or possibly testdir1 and testdir2, I'm not clear on that but for now either would work). Instead it hangs, to my knowledge it does not time out. I tried to let it sit there but after a few minutes I got impatient and force unmounted it from another shell. Still not seeing anything in logs. I'm obviously doing something wrong and it's not really mounted but I can't figure out what.
I've tried messing around with the command structure, as well as using mount, vaguely to the effect of
mount -t fuse -o dirs=/var/tmp/testdir1=ro:/var/tmp/testd
but mount doesn't like anything I do with it. The unfortunate reality is much of what I'm trying to build into the command is copy-pasted from various articles about unioning that don't actually explain the command structure so I'm struggling to build the command. (ie, what is unionfs#NONE doing exactly? I've seen a bunch of walk throughs that use it in the mount command but what's it doing there? I couldn't find anything about it in the manpage for mount but removing it doesn't work either?)
Any help would be greatly appreciated. Unioning is a really cool concept but I just don't understand how to implement it well enough yet.
Update: Okay, I've got the union working but the copy-on-write/editing part is still screwed up. I think I was getting confused between unionfs-fuse, funionfs, and unionfs as I was struggling to find documentation for any. I rolled back my vm to the base Debian image, installed unionfs-fuse through apt-get, and am now here:
# unionfs-fuse -o cow -o allow_other -o default_permissions /home/[username]=ro:/usr/share/doc=ro /mnt/union
(I got sick of creating test files/directories so I'm using existing directories with plentiful files in them)
debian:/mnt/union# mount
::snipped for irrelevant entries::
fusectl on /sys/fs/fuse/connections type fusectl (rw)
unionfs-fuse on /mnt/union type fuse.unionfs-fuse (rw,nosuid,nodev,allow_other,default_per
I have a plaintext file in my home directory named 'file'. After I run the unionfs-fuse mount command I can see that file and all the /usr/share/doc/ files happily mingled in /mnt/union. I open /mnt/union/file in vi, and append some text. When I do :w to write I get E212: Can't open file for writing. I then :q!. I now have the following files/swaps:
in /mnt/union: file file~ filz~
in /home/[username]: file~ .file.swp filz~ file .file.swo .file.swpx
I am currently root so the writing shouldn't be a permissions issue. Getting closer at least!
