On May 13, 2014 6:59:56 PM EDT, Patrick Welche <[email protected]> wrote: >I thought that one use of mount_union was to be able to layer >read/write >filesystem over a read/only filesystem, such that writing would >create a file in the upper filesystem, and reading would read an >unchanged >file from the lower one. Is this correct?
Yep. >A quick experiment on -current/amd64: > ># mkdir /var/upper ># mkdir /var/lower ># touch /var/lower/file ># mount_union /var/upper /var/lower ># mount >... ><above>:/var/upper on /var/lower type union (local) ># ls /var/upper ># ls /var/lower >file > >I would have expected to see file in /var/upper I would expect that too, and in fact that's what I see on my system (NetBSD 6.1.3). Is there still no file in /var/upper after unmounting the union mount? Maybe something is getting cached, or it's broken in -current? ># touch /var/upper/another ># ls /var/upper >another ># ls /var/lower >another file > >I would not have expected to see another in /var/lower Of course you would, since the kernel is causing anything in /var/upper to appear at the /var/lower mount point. However, I think it might be "not recommended" to go mucking around in /var/upper while it's in use as part of a union mount. On the other hand, if it's present in /var/lower after unmounting, then something is very wrong. Eric
