tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Implementing mount_union(8) into vfs (for -o union)?



Hi,

I've already had some talk with dh on IRC about that now, and it seems rather
that the current union filesystem is broken.

> > >I've just been trying to mount a tmpfs over a read-only root 
> > >file system.  Unfortunately, this won't work just by mounting a 
> > >tmpfs with option union over the root file system. You'd have to 
> > >create a tmpfs, and mount that one with mount_union(8) over the 
> > >root file system, which is again not possible.
> > 
> > I read your message twice and I still don't know what you mean. 
> > Could you give examples of the commands that you use, and the 
> > errors.
The first case is by using the mount option 'union'. E.g. in single user mode
(i.e. before remounting / read-write), you type in `mount -t tmpfs -o union
tmpfs /`. This will work for anything that does not already exist on the
lower layer, but you cannot change anything that is on the root disk or would
be in it, e.g. changing permissions in /var or creating anything in /var
would return EROFS.
The second case is later on, you do `mount -t tmpfs tmpfs /tmp; mount -t
union /tmp /var/tmp`. Then you'd have /tmp as another layer on /var/tmp. You
shouldn't be able to do this with the root file system, as you would directly
create a loop.

The target I want to achieve is simple: I want to boot a live system with
writable root fs (not necessarily keep it after reboot), without having to do
a dance with tmpfs, union and nullfs to achieve that somehow not completely.
It'd be nice if you just issue `mount -t tmpfs -o union tmpfs /` and you're
done.

I'm not using the term 'unionfs' as there are in fact three things: Union
mount option, union mount, and unionfs mount (the latter should be the
FreeBSD union mount, but not finished importing).

> An example of using unionfs, rather than union dirs, is in
> src/distrib/embedded/mkimage - which unfortunately has too many tmpfs
> incantations, but does work well for usermode.  More should happen in
> this area in future.  I think that I used mount_union as union dirs
> didn't handle whiteouts properly, but it's been a while, and I didn't
> write things down from that period.
There is no src/distrib/embedded?

> One thing I did find was that some log files are opened O_WRONLY|O_APPEND,
> and so need to be copied manually into the upper layer first or the
> corresponding upper-layer entry does not created.
Thank you, I didn't know that. I've rarely used union until now anyway.


Regards, Julian

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index