Parallel mounting of ZFS filesystem was introduced in r344569 and is great for shortening the boot time. The change creates a cosmetic problem, partial ordering of the mounted filesystems. Here’s a shell script coercing the output of df(1) into a comprehensible listing.

#!/bin/sh
#-
# Parallel mounting of ZFS filesystems leads to partial ordering of the
# mounted filesystems.
# Separating the header from the remaining lines and sorting the latter
# before recombining is a viable solution.
#-

# https://lists.freebsd.org/pipermail/freebsd-current/2019-March/073016.html
# https://lists.freebsd.org/pipermail/freebsd-current/2019-March/073022.html
/bin/df ${@} | /usr/bin/awk '/^Filesystem/ { print; sort = "/usr/bin/sort -sk " NF-1 } ! /^Filesystem/ { print | sort }'

# df-sorted.sh

Here’s a listing produced by plain df(1) on FreeBSD/amd64 base/head r344876:

Filesystem                            Size    Used   Avail Capacity  Mounted on
zroot/ROOT/20190307-r344876            14G    1,6G     13G    11%    /
devfs                                 1,0K    1,0K      0B   100%    /dev
zroot/usr/compat                       13G     29K     13G     0%    /usr/compat
zroot/tmp                             1,0G     49K    1,0G     0%    /tmp
zroot/var/synth                        13G     34K     13G     0%    /var/synth
zroot/home                             13G     29K     13G     0%    /home
zroot/usr/local                        13G    547M     13G     4%    /usr/local
zroot/var/lib                          13G     29K     13G     0%    /var/lib
zroot/var/tmp                         1,0G     30K    1,0G     0%    /var/tmp
zroot/var/log                          13G     13M     13G     0%    /var/log
zroot/var/unbound                      13G     29K     13G     0%    /var/unbound
zroot/var/run                          13G     48K     13G     0%    /var/run
zroot/var/Named                        13G     29K     13G     0%    /var/Named
zroot/var/audit                        13G     29K     13G     0%    /var/audit
zroot/var/db/boinc                     13G     29K     13G     0%    /var/db/boinc
zroot/var/db/mysql                     13G     29K     13G     0%    /var/db/mysql
zroot/media                            13G     32K     13G     0%    /media
zroot/var/db/tlpkg                     13G     29K     13G     0%    /var/db/tlpkg
zroot/usr/src                          15G    2,3G     13G    15%    /usr/src
zroot/var/db/ports                     13G    187K     13G     0%    /var/db/ports
zroot/var/db/bacula                    13G     29K     13G     0%    /var/db/bacula
zroot/var/db/pkg                       13G     37M     13G     0%    /var/db/pkg
zroot/var/spool                        13G     32K     13G     0%    /var/spool
zroot/var/db/hyperv                    13G     29K     13G     0%    /var/db/hyperv
zroot/var/crash                        13G     30K     13G     0%    /var/crash
zroot/var/db/etcupdate                 13G    1,0M     13G     0%    /var/db/etcupdate
zroot/var/backups                      13G     10M     13G     0%    /var/backups
zroot/var/db/fontconfig                13G     29K     13G     0%    /var/db/fontconfig
zroot/var/db/mysql_secure              13G     29K     13G     0%    /var/db/mysql_secure
zroot/var/db/mysql_tmpdir              13G     29K     13G     0%    /var/db/mysql_tmpdir
zroot/nfs                              13G     29K     13G     0%    /nfs
zroot/usr/ports                        14G    1,3G     13G     9%    /usr/ports
zroot/var/synth/live_packages          13G    452M     13G     3%    /var/synth/live_packages
zroot/usr/obj                          18G    5,2G     13G    29%    /usr/obj
zroot/var/mail                         13G    896K     13G     0%    /var/mail
zroot/var/cache/pkg                    13G     29K     13G     0%    /var/cache/pkg
zroot/usr/compat/linux                 13G     31K     13G     0%    /usr/compat/linux
zroot/var/empty                        13G     29K     13G     0%    /var/empty
zroot/usr/local/tests                  13G     29K     13G     0%    /usr/local/tests
zroot/usr/local/certs                  13G     29K     13G     0%    /usr/local/certs
zroot/usr/local/etc                    13G    676K     13G     0%    /usr/local/etc
zroot/home/trond                       13G    1,2M     13G     0%    /home/trond
zroot/usr/local/info                   13G     31K     13G     0%    /usr/local/info
zroot/var/synth/builders               13G     31K     13G     0%    /var/synth/builders
zroot/var/spool/ftp                    13G     29K     13G     0%    /var/spool/ftp
zroot/var/spool/mqueue                 13G     29K     13G     0%    /var/spool/mqueue
zroot/usr/local/var                    13G     29K     13G     0%    /usr/local/var
zroot/usr/local/www                    13G     29K     13G     0%    /usr/local/www
zroot/var/log/synth                    13G    5,4M     13G     0%    /var/log/synth
zroot/usr/local/pgsql                  13G     29K     13G     0%    /usr/local/pgsql
zroot/var/spool/clientmqueue           13G    163K     13G     0%    /var/spool/clientmqueue
zroot/usr/ports/workdirs               13G     29K     13G     0%    /usr/ports/workdirs
zroot/usr/ports/packages               13G     29K     13G     0%    /usr/ports/packages
zroot/usr/ports/distfiles              14G    1,0G     13G     8%    /usr/ports/distfiles
zroot/usr/local/pgsql/data             13G     29K     13G     0%    /usr/local/pgsql/data
zroot/usr/local/pgsql/data/base        13G     29K     13G     0%    /usr/local/pgsql/data/base
zroot/usr/local/pgsql/data/pg_xlog     13G     29K     13G     0%    /usr/local/pgsql/data/pg_xlog
zroot/var/cache/ccache                 14G    1,5G     13G    11%    /var/cache/ccache
fdescfs                               1,0K    1,0K      0B   100%    /dev/fd
procfs                                4,0K    4,0K      0B   100%    /proc
devfs                                 1,0K    1,0K      0B   100%    /usr/compat/linux/dev
fdescfs                               1,0K    1,0K      0B   100%    /usr/compat/linux/dev/fd
linprocfs                             4,0K    4,0K      0B   100%    /usr/compat/linux/proc
linsysfs                              4,0K    4,0K      0B   100%    /usr/compat/linux/sys

Here’s a listing produced by df-sorted.sh -ah on the same system:

Filesystem                            Size    Used   Avail Capacity  Mounted on
zroot/ROOT/20190307-r344876            14G    1,6G     13G    11%    /
devfs                                 1,0K    1,0K      0B   100%    /dev
fdescfs                               1,0K    1,0K      0B   100%    /dev/fd
zroot/home                             13G     30K     13G     0%    /home
zroot/home/trond                       13G    1,2M     13G     0%    /home/trond
zroot/media                            13G     32K     13G     0%    /media
zroot/nfs                              13G     30K     13G     0%    /nfs
procfs                                4,0K    4,0K      0B   100%    /proc
zroot/tmp                             1,0G     49K    1,0G     0%    /tmp
zroot/usr/compat                       13G     30K     13G     0%    /usr/compat
zroot/usr/compat/linux                 13G     31K     13G     0%    /usr/compat/linux
devfs                                 1,0K    1,0K      0B   100%    /usr/compat/linux/dev
fdescfs                               1,0K    1,0K      0B   100%    /usr/compat/linux/dev/fd
linprocfs                             4,0K    4,0K      0B   100%    /usr/compat/linux/proc
linsysfs                              4,0K    4,0K      0B   100%    /usr/compat/linux/sys
zroot/usr/local                        13G    547M     13G     4%    /usr/local
zroot/usr/local/certs                  13G     30K     13G     0%    /usr/local/certs
zroot/usr/local/etc                    13G    676K     13G     0%    /usr/local/etc
zroot/usr/local/info                   13G     31K     13G     0%    /usr/local/info
zroot/usr/local/pgsql                  13G     30K     13G     0%    /usr/local/pgsql
zroot/usr/local/pgsql/data             13G     30K     13G     0%    /usr/local/pgsql/data
zroot/usr/local/pgsql/data/base        13G     30K     13G     0%    /usr/local/pgsql/data/base
zroot/usr/local/pgsql/data/pg_xlog     13G     30K     13G     0%    /usr/local/pgsql/data/pg_xlog
zroot/usr/local/tests                  13G     30K     13G     0%    /usr/local/tests
zroot/usr/local/var                    13G     30K     13G     0%    /usr/local/var
zroot/usr/local/www                    13G     30K     13G     0%    /usr/local/www
zroot/usr/obj                          18G    5,2G     13G    29%    /usr/obj
zroot/usr/ports                        14G    1,3G     13G     9%    /usr/ports
zroot/usr/ports/distfiles              14G    1,0G     13G     8%    /usr/ports/distfiles
zroot/usr/ports/packages               13G     30K     13G     0%    /usr/ports/packages
zroot/usr/ports/workdirs               13G     30K     13G     0%    /usr/ports/workdirs
zroot/usr/src                          15G    2,3G     13G    15%    /usr/src
zroot/var/audit                        13G     30K     13G     0%    /var/audit
zroot/var/backups                      13G     10M     13G     0%    /var/backups
zroot/var/cache/ccache                 14G    1,5G     13G    11%    /var/cache/ccache
zroot/var/cache/pkg                    13G     30K     13G     0%    /var/cache/pkg
zroot/var/crash                        13G     30K     13G     0%    /var/crash
zroot/var/db/bacula                    13G     30K     13G     0%    /var/db/bacula
zroot/var/db/boinc                     13G     30K     13G     0%    /var/db/boinc
zroot/var/db/etcupdate                 13G    1,0M     13G     0%    /var/db/etcupdate
zroot/var/db/fontconfig                13G     30K     13G     0%    /var/db/fontconfig
zroot/var/db/hyperv                    13G     30K     13G     0%    /var/db/hyperv
zroot/var/db/mysql                     13G     30K     13G     0%    /var/db/mysql
zroot/var/db/mysql_secure              13G     30K     13G     0%    /var/db/mysql_secure
zroot/var/db/mysql_tmpdir              13G     30K     13G     0%    /var/db/mysql_tmpdir
zroot/var/db/pkg                       13G     37M     13G     0%    /var/db/pkg
zroot/var/db/ports                     13G    187K     13G     0%    /var/db/ports
zroot/var/db/tlpkg                     13G     30K     13G     0%    /var/db/tlpkg
zroot/var/empty                        13G     30K     13G     0%    /var/empty
zroot/var/lib                          13G     30K     13G     0%    /var/lib
zroot/var/log                          13G     13M     13G     0%    /var/log
zroot/var/log/synth                    13G    5,4M     13G     0%    /var/log/synth
zroot/var/mail                         13G    896K     13G     0%    /var/mail
zroot/var/Named                        13G     30K     13G     0%    /var/Named
zroot/var/run                          13G     48K     13G     0%    /var/run
zroot/var/spool                        13G     32K     13G     0%    /var/spool
zroot/var/spool/clientmqueue           13G    163K     13G     0%    /var/spool/clientmqueue
zroot/var/spool/ftp                    13G     30K     13G     0%    /var/spool/ftp
zroot/var/spool/mqueue                 13G     30K     13G     0%    /var/spool/mqueue
zroot/var/synth                        13G     34K     13G     0%    /var/synth
zroot/var/synth/builders               13G     31K     13G     0%    /var/synth/builders
zroot/var/synth/live_packages          13G    452M     13G     3%    /var/synth/live_packages
zroot/var/tmp                         1,0G     30K    1,0G     0%    /var/tmp
zroot/var/unbound                      13G     30K     13G     0%    /var/unbound

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>