update zfs startup script to auto mount zfs swap volumes

Status
Not open for further replies.

b0bje

Dabbler
Joined
Sep 16, 2011
Messages
16
I noticed that /etc/rc.d/zfs differs from the one in freebsd8.x.

Would the devs please consider restoring the bit that does the swapon command for
volumes that have org.freebsd:swap=on ?

If not, I can always add it manually after each update/reinstall, but I believe this functionality will benefit more people then just me and don't really see a reason why it would be absent.

/etc/rc.d/zfs adjust zfs_start_main() like below:

Code:
zfs_start_main()
{
        zfs mount -a
        zfs share -a
        if [ ! -r /etc/zfs/exports ]; then
                touch /etc/zfs/exports
        fi
        # Enable swap on ZVOLs with property org.freebsd:swap=on.
        zfs list -H -o org.freebsd:swap,name -t volume | \
        while read state name; do
                case "${state}" in
                [oO][nN])
                        swapon /dev/zvol/${name}
                        ;;
                esac
        done
}
 
Status
Not open for further replies.
Top