On February 8, 2018 4:42:57 PM UTC, Peter Tribble <peter.trib...@gmail.com>
>On Thu, Feb 8, 2018 at 3:30 PM, Marc Lobelle
>> Hello All,
>> Today I had a very curious message when trying to mount a file system
>> non-empy directory
>> cannot mount '/export/home/ml/mydirname': directory is not empty
>> Afaik, mounting on a non empty directory has always been allowed: the
>> original contents is just temporarily hidden.
>zfs has always refused to mount over a non-empty directory by default
>> mounting was done automatically as a byproduct of
>> zpool import -d /dev/lofi szpool
>> szpool had been created by
>> zpool create -m /export/home/ml/mydirname szpool /dev/lofi/1
>> Is there a good reason to prohibit mounting on a non-empty directory
>> this case ?
>It's to stop you making mistakes.
>> Is there a way to avoid this constraint ?
>'zfs mount -O' will override the non-empty check.
IIRC one of the rationales is that if you have several pools and import them at
once (not in sequential predefined order) and they define parts of the same
namespace, you can end up with some datasets "overshadowing" others - unless
they are mounted into empty locations (e.g. no empty - or full - dirs there
with someone else's mountpoints). So to ensure predictability, this check is
there and should stay by default.
To override it there are mount options (for `mount -F zfs` forever - so you
could use it for rootfs bits in /etc/vfstab for example, and `zfs mount` more
recently I guess). I campaigned for a dataset property to this effect (so e.g.
/var/tmp can overshadow a non-empty location always on my boxes), not sure it
was made by anyone.
Also note that you can protect mountpoints from getting written into with
native (non-GNU) chmod:
/bin/chmod -S+ci /var/tmp
for example. Of course, do it on the parent dataset's empty directory - before
anything is mounted into that point. Note this won't work in Solaris 10 (last
Sun 10u8 at least).
To make ordered pool imports, see my wiki articles and github repo for wrapping
pools into SMF services so you can order dependencies between them (and other
services that need their data, e.g. SMF-wrapped zones whose roots or data live
on such a pool).
Hope this helps,
Typos courtesy of K-9 Mail on my Android
openindiana-discuss mailing list