DSL Tips and Tricks :: unionfs examples



I was messing with unionfs, and came up with something.  First I created XFree86.uci, it mounts as /opt/XFree86/usr.  Then I ran...

mount -t unionfs -o dirs=/usr=ro:/opt/XFree86/usr=ro unionfs /usr

What I have ended up with is a working XFree86 without having to make /usr writeable.  This saves alot of memory, but I was wondering if there are there any adverse effects.  (I am running a frugal install.)  The only thing I noticed is that I had to add "umount unionfs" to powerdown.sh to umount /usr so that XFree86.uci properly un-mounts.

That's EXACTLY what I was wondering about :)

Thanks for experimenting.

That totally blew my mind.  I didn't know that a union could contain the directory it points to.  You might want to make the /usr directory rw (read write) instead of ro (read only).

I think /usr became writeable when you loaded the unionfs.dsl.  Loading dsl files runs mkwriteable which makes that directory and others writeable, but their contents are still links into /KNOPPIX.  The fact that you could modify the files that were from your uci's usr directory is really nice, though.

Just out of cuiousity, did you run free at all to check the amounts of memory at various points in the process compared to the traditional way?  Like loading XFree86.dsl and running free, then restarting and running it with your uci and running free again to check the difference?

Like clivesay said, thanks for experimenting.

EDIT:

I don't think that works.  It's a nice idea but I don't believe the union can contain its own contents.  I also found out it's really easy to mess things up when your changing the /usr directory and where it's link points.

Clacker, I actually didn't tell you the whole story, I took your .dsl extension, and remade it into a .uci extension :D.  It mounts in opt and loads the module with "insmod", leaving /usr read-only.  I didn't check free on the old setup (XFree86.dsl), but I know it was using 30-50 meg of swap as soon as X started.  Running frugal now, after just loading unionfs.uci and xfree86.uci, free shows Mem:  78164 total, 61984 used, 16180 free - Swap 156200 total, 0 used 156200 free.

I have even managed to shave about 30 seconds off of the boot time from the old debian styled install I ran before trying frugal, and probably close to a min when I first started using frugal and having to load XFree86.dsl at boot.

As far as I can tell when looking through /usr, it seems unionfs made a seemless integration between /usr and /opt/XFree86/usr (the mount of XFree86.uci).  I even tried going to the console running "umount unionfs", "startx", and there were errors, "No X server found".  Re-run the "mount -t unionfs ........" command, and everything works fine again.

That's pretty awesome
Next Page...
original here.