[Bug 237517] ZFS parallel mounting sometimes misses mounting intermediate filesystems

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue May 21 22:17:20 UTC 2019


Peter Eriksson <pen at lysator.liu.se> changed:

           What    |Removed                     |Added
                 CC|                            |pen at lysator.liu.se

--- Comment #5 from Peter Eriksson <pen at lysator.liu.se> ---
We do something similar on our servers - however the main reason we do it is to
speed things up. Normally a standard "zfs mount -a" would take slightly less
than 1 hour to execute (a lot of ZFS filesystems) which was a bit of a pain
when we needed to reboot the servers (or they crashed during office hours).

So we've been investigating various ways of speeding things up. A hack was to
run a large number of individual "zfs mount $FS" commands in parallell, but
then you need to sort the filesystems so they get mounted in the right order...
We also do the bulk of the filesystem mounting in the background so we atleast
get a login prompt and can login to the machine and see what is happening...
The hack was surprisingly effective - 5-10 minutes instead of 1 hour. :-)

The scripts can very probably be improved a lot but they do the job for us.
Would have been nice to have a "zfs mount --recursive POOL" command. Or a "zfs
mount --parallell=20 -a" command. :-)

>From our /etc/rc.d/zfs:

        /sbin/zfs-speedmount > /var/log/zfs/zfs-speedmount.log 2>&1
        zfs share -a
        touch /etc/zfs/exports


        if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then
            # Empty exports-file, to prevent annoying error messages while
            echo -n "" > /etc/zfs/exports

            # Mount all other root pool filesystems first
            /sbin/zfs-mountrpool -v

            # And then we do the rest in the background
            zfs_start_main &

(I'll add our scripts as attachments in case they might be useful to someone).

You are receiving this mail because:
You are the assignee for the bug.

More information about the freebsd-fs mailing list