ZFS mountpoint and inheritance

Hi all,
I was wondering if there is a way for a ZFS filesystem to be mounted outside the parent base mount point (i.e., inherited) without having to use the legacy way. I did not find a way to remove the inheritance of a mount point.
 
You can set the mountpoint of the ZFS filesystem to anything you want.

# zfs set mountpoint="/some/where" tank/Some/Filesystem
# zfs set mountpoint="/another/directory" tank/Some/Filesystem/test

If you don't set the mountpoint it will be inherited from the parent.
 
Of course I can set the mountpoint to whatever I want, but the absolute path will start under the inherited path of the parent filesystem. I want to remove the parent-inheritance relationship.
 
fluca1978 said:
Of course I can set the mountpoint to whatever I want, but the absolute path will start under the inherited path of the parent filesystem.
No, it will not.


Code:
root@molly:~#zfs create tank/FreeBSD/test
root@molly:~#zfs create tank/FreeBSD/test/test2
root@molly:~#zfs set mountpoint="/mnt/test" tank/FreeBSD/test
root@molly:~#zfs set mountpoint="/storage/test" tank/FreeBSD/test/test2
root@molly:~#mount | grep test
tank/FreeBSD/test on /mnt/test (zfs, local, noatime, nfsv4acls)
tank/FreeBSD/test/test2 on /storage/test (zfs, local, noatime, nfsv4acls)
 
After changing mountpoint you can further interfere by setting the canmount property to noauto. This will prevent zfs from mounting automatically. You can then mount by command (specify -t zfs) or by placing an entry in fstab.
 
I think I explained very badly my problem: the filesystems can be moved but will inherit the mountpoint of the pool they belongs to. This is what I want to avoid.

Code:
[root@nas] ~# zfs create RPOOL/parentfs
[root@nas] ~# zfs create RPOOL/parentfs/childrenfs
[root@nas] ~# mount
...
RPOOL/parentfs on /mnt/RPOOL/parentfs (zfs, local)
RPOOL/parentfs/childrenfs on /mnt/RPOOL/parentfs/childrenfs (zfs, local)

[root@nas] ~# zfs set mountpoint=/tmp/test RPOOL/parentfs/childrenfs
[root@nas] ~# zfs set mountpoint=/tmp/test2 RPOOL/parentfs
[root@nas] ~# mount
...
RPOOL/parentfs/childrenfs on /mnt/tmp/test (zfs, local)
RPOOL/parentfs on /mnt/tmp/test2 (zfs, local)

[root@nas] ~# zpool list
NAME    SIZE   USED  AVAIL    CAP  HEALTH  ALTROOT
RPOOL  7.25T   849G  6.42T    11%  ONLINE  /mnt
 
RPOOL its self is a zfs in addition to being a zpool name. Try disabling RPOOL interference by setting:
# zfs set mountpoint=none RPOOL
# zfs set canmount=off (or noauto) RPOOL

I think your altroot is preventing the changes from being pushed through. After you run the above try to export your pool and re-import.
 
Back
Top