Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a recursive option to zfs mount #2901

Open
krichter722 opened this issue Nov 15, 2014 · 2 comments
Open

add a recursive option to zfs mount #2901

krichter722 opened this issue Nov 15, 2014 · 2 comments
Labels
Type: Feature Feature request or new feature

Comments

@krichter722
Copy link

I'd be great to have an option for zfs mount which doesn't mount specific dataset or all datasets, like zfs mount -a, but all datasets which are children of a dataset x, e.g. zfs mount -r x should mount the existing datasets x/1, x/2/alpha, but not a and a/3 (well, you know what recursive means :)). The -a option could be reused, i.e. the meaning of zfs mount -a <dataset> would become different from zfs mount -a without dataset specification, but I guess that adding an option, e.g. -r would be more elegant and easier to test and document.

The mountpoints should be checked recursively for conflicting mountpoint, which would be identical one and those which are deeper in the tree than than predecessors in a top down iteration of the tree. The command should simply fail when such a conflict is encountered.

@QORTEC
Copy link

QORTEC commented Apr 15, 2021

This feature would be especially useful if we where to add an option that would mount all child datasets with the property of canmount=noauto.

zfs mount
-a filesystem
    Mounts the specified filesystem and its children. If no filesystem is specified, then all available ZFS file systems are mounted. Invoked automatically as part of the boot process if configured.
-r filesystem
    Mounts the specified filesystem and its children. Note filesystems with the canmount=noauto property will also be mounted.

One use-case for this feature would be multi-boot environments; currently there is no elegant way to setup a multi-boot environment with child datasets that are boot environment specific.

# zfs list -r -o name,canmount,mountpoint syspool/ROOT
NAME                         CANMOUNT  MOUNTPOINT
syspool/ROOT                      off  none
syspool/ROOT/bootenv1          noauto  /
syspool/ROOT/bootenv2          noauto  /
syspool/ROOT/bootenv3          noauto  /
syspool/ROOT/bootenv3/tmp      noauto  /tmp
syspool/ROOT/bootenv3/var         off  /var
syspool/ROOT/bootenv3/var/log  noauto  /var/log
# zfs mount -r syspool/ROOT/bootenv3
# df --output=source,target
Filesystem                                 Mounted on
syspool/ROOT/bootenv3                      /
syspool/ROOT/bootenv3/tmp                  /tmp
syspool/ROOT/bootenv3/var/log              /var/log

@Jip-Hop
Copy link

Jip-Hop commented Apr 16, 2022

I'm currently instructing to use zfs mount -a to mount a backup pool and all descending datasets (see the Recovery paragraph). But this has the side effect of also mounting other filesystems (not just the backup pool and children). A dedicated zfs mount -a <dataset> option would be great in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Feature request or new feature
Projects
None yet
Development

No branches or pull requests

4 participants