ZFS no longer mounted in alphanumerical order
Jan Martin Mikkelsen
janm at transactionware.com
Tue Mar 12 10:44:19 UTC 2019
> On 12 Mar 2019, at 10:37, Trond Endrestøl <Trond.Endrestol at fagskolen.gjovik.no> wrote:
> I concocted a shell script, it looks promising:
>
> #!/bin/sh
> #-
> # Parallel mounting of ZFS filesystems leaves a chaotic listing of
> # mounted filesystems when viewed by df(1).
> # Separating the header from the remaining lines and sorting the
> # latter before recombining is a viable solution.
> #-
>
> DF=/bin/df
>
> ${DF} ${@} | grep ^Filesystem
> ${DF} ${@} | grep -v ^Filesystem | sort -k 6
>
> # new-df.sh
An alternative sort approach, which handles df arguments which change the number of columns, and only invokes df once:
${DF} "$@" | awk '/^Filesystem/ { print; sort = "sort -k " NF } ! /^Filesystem/ { print | sort }’
Regards,
Jan.
More information about the freebsd-current
mailing list