NetBSD/etc/rc.d/zfs
brad 12ea0a140d Add support for legacy ZFS filesystems, specified by mountpoint=legacy
in the ZFS properties of the dataset and a simple man page for
mount_zfs.  With this, it is possible to put ZFS filesystems in
/etc/fstab as file system type zfs.

Add a rc.d script that kicks the module ZFS load mostly before
mountall runs simular to what LVM does.  This allows for any legacy
mounts to be specified in critical_local_filesystems and allows for
ZFS pools on top of cgd (probably among other things).  Introduce a
rc.conf variable called zfs which needs to be set to YES, in the usual
manor of things, to get zvols and ZFS dataset support rather then just
assume that 'zfs mount' does that in mountall.  Fix a problem in
mountall if ZFS is not compiled into the system.
2019-09-15 19:38:08 +00:00

39 lines
672 B
Bash

#!/bin/sh
#
# $NetBSD: zfs,v 1.1 2019/09/15 19:38:09 brad Exp $
#
# PROVIDE: zfs
# REQUIRE: root
# BEFORE: DISKS
$_rc_subr_loaded . /etc/rc.subr
name="zfs"
start_cmd="zfs_start"
stop_cmd="zfs_stop"
zfs_start()
{
if [ -x /sbin/zfs -a -f /etc/zfs/zpool.cache ]; then
# Get ZFS module loaded (and thereby, zvols created).
/sbin/zfs list > /dev/null 2>&1
if [ $? -ne 0 ]; then
warn "zfs module may not have loaded, may not be present in the kernel, or /dev/zfs may be missing"
return 1;
fi
fi
}
zfs_stop()
{
if [ -x /sbin/zfs -a -f /etc/zfs/zpool.cache ]; then
zfs unmount -a
modunload zfs
fi
return 0;
}
load_rc_config $name
run_rc_command "$1"