[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: zfs, autofs dependencies



On 01.04.2015 17:55, Reco wrote:
> No, the problem is related to the Debian indeed. As ZFS is used as an
> LVM here, so you might as well replace those fancy/dev/zvol/* with
> something conventional, and the problem will still remain.
>
> Consider the following /etc/fstab.
>
> /dev/sda1 /backup          ext4 noauto,nofail,user_xattr 0 2
> /dev/sda2 /backup/network  ext4 noauto,nofail,user_xattr 0 2
> /dev/sda3 /backup/op       ext4 noauto,nofail,user_xattr 0 2
>
> How do you can use /etc/fstab to specify a mount order? Without
> resorting to the shell scripts, of course.

You are right. ZFS here acts only as an LVM to create those devices. But zfs-mount reads the content of /etc/fstab and if find's any device within /dev/zvol/ it does for it a simple mount command.

The zfs-mount contains this script to mount:

read_fstab() {
        for fs in "${!FSTAB[@]}" ; do unset FSTAB["$fs"] ; done
        while read -r fs mntpnt fstype opts blah ; do
                fs=`printf '%b\n' "$fs"`
                FSTAB["$fs"]=$mntpnt
        done < <(grep -E "$1" /etc/fstab)
}
do_mount()
{
    if [ -n "$POOL_IMPORTED" ]; then
        [ "$VERBOSE_MOUNT" == 'yes' ] && verbose=v
        [ "$DO_OVERLAY_MOUNTS" == 'yes' ] && overlay=O

        $log_begin_msg "Mounting ZFS filesystems not yet mounted"
        $ZFS mount -a$verbose$overlay $MOUNT_EXTRA_OPTIONS
        RET=$?

        if [ $RET != 0 ] ; then
            $log_end_msg $RET
            exit $RET
        fi
        $log_end_msg 0

        read_mtab  "^/dev/(zd|zvol)"
        read_fstab "^/dev/(zd|zvol)"

        $log_begin_msg "Mounting volumes registered in fstab: "
        for volume in "${!FSTAB[@]}" ; do
            if in_mtab "$volume" ; then continue ; fi

            $log_progress_msg "$volume "
            mount "$volume"
        done

        $log_end_msg 0
    fi
}
start()
{
    checksystem && {
        case "$ZFS_MOUNT" in
            ([Oo][Ff][Ff]|[Nn][Oo]|'')
                exit 3
                ;;
        esac

        do_import
        do_mount
        do_mount
        touch "$LOCKDIR/$servicename"
    }
}

As it can be seen, mount of devices are done in the order which they are described in /etc/fstab. Maybe the next mount command is started before previous mount command finished and fully mounted /backup?


Reply to: