Re: [OpenIndiana-discuss] surprising behaviour of mount

2018-02-09 Thread Jim Klimov
On February 8, 2018 3:30:13 PM UTC, Marc Lobelle  
wrote:
>Hello All,
>
>Today I had a very curious message when trying to mount a file system
>on 
>a 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.
>
>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 in
>
>this case ? Is there a way to avoid this constraint ?
>
>Thanks
>
>
>Marc
>
>
>
>
>
>___
>openindiana-discuss mailing list
>openindiana-discuss@openindiana.org
>https://openindiana.org/mailman/listinfo/openindiana-discuss

Clarifying bits WRT my earlier detailed reply:

>Afaik, mounting on a non empty directory has always been allowed: the original 
>contents is just temporarily hidden.

Yes for 'mount', no for 'zfs mount'

> mounting was done automatically as a byproduct of
> zpool import -d /dev/lofi szpool

This implies a 'zfs mount', so...

Jim
--
Typos courtesy of K-9 Mail on my Android

___
openindiana-discuss mailing list
openindiana-discuss@openindiana.org
https://openindiana.org/mailman/listinfo/openindiana-discuss


Re: [OpenIndiana-discuss] surprising behaviour of mount

2018-02-09 Thread Jim Klimov
On February 8, 2018 4:42:57 PM UTC, Peter Tribble  
wrote:
>On Thu, Feb 8, 2018 at 3:30 PM, Marc Lobelle
>
>wrote:
>
>> Hello All,
>>
>> Today I had a very curious message when trying to mount a file system
>on a
>> 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
>in
>> 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.

Hi,

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,
Jim Klimov
--
Typos courtesy of K-9 Mail on my Android

___
openindiana-discuss mailing list
openindiana-discuss@openindiana.org
https://openindiana.org/mailman/listinfo/openindiana-discuss


Re: [OpenIndiana-discuss] surprising behaviour of mount

2018-02-08 Thread Marcel Telka
On Thu, Feb 08, 2018 at 04:42:57PM +, Peter Tribble wrote:
> It's to stop you making mistakes.

And allow you to do different mistakes.

-- 
+---+
| Marcel Telka   e-mail:   mar...@telka.sk  |
|homepage: http://telka.sk/ |
|jabber:   mar...@jabber.sk |
+---+

___
openindiana-discuss mailing list
openindiana-discuss@openindiana.org
https://openindiana.org/mailman/listinfo/openindiana-discuss


Re: [OpenIndiana-discuss] surprising behaviour of mount

2018-02-08 Thread Marcel Telka
On Thu, Feb 08, 2018 at 04:30:13PM +0100, Marc Lobelle wrote:
> Is there a good reason to prohibit mounting on a non-empty directory in this
> case ?

IMHO, no.

> Is there a way to avoid this constraint ?

Some suggestions are here:
https://www.illumos.org/issues/5579

-- 
+---+
| Marcel Telka   e-mail:   mar...@telka.sk  |
|homepage: http://telka.sk/ |
|jabber:   mar...@jabber.sk |
+---+

___
openindiana-discuss mailing list
openindiana-discuss@openindiana.org
https://openindiana.org/mailman/listinfo/openindiana-discuss


Re: [OpenIndiana-discuss] surprising behaviour of mount

2018-02-08 Thread Peter Tribble
On Thu, Feb 8, 2018 at 3:30 PM, Marc Lobelle 
wrote:

> Hello All,
>
> Today I had a very curious message when trying to mount a file system on a
> 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 in
> 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.

-- 
-Peter Tribble
http://www.petertribble.co.uk/ - http://ptribble.blogspot.com/
___
openindiana-discuss mailing list
openindiana-discuss@openindiana.org
https://openindiana.org/mailman/listinfo/openindiana-discuss