summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2007-04-06 02:27:02 +0000
committerpjd <pjd@FreeBSD.org>2007-04-06 02:27:02 +0000
commit4474431c34b1973b89b02a02cd54a55ea97648aa (patch)
tree4ee993e86835d9121b6e14210c1db11b2324ba9d
parent170e632d642afcedd747a3c8bdf45f63d1a36f53 (diff)
downloadFreeBSD-src-4474431c34b1973b89b02a02cd54a55ea97648aa.zip
FreeBSD-src-4474431c34b1973b89b02a02cd54a55ea97648aa.tar.gz
- Add ZFS startup script.
Submitted by: des - When starting mountd(8) and ZFS is enabled, add /etc/zfs/exports file. - Update rc.conf(5).
-rw-r--r--etc/defaults/rc.conf3
-rwxr-xr-xetc/rc.d/Makefile3
-rwxr-xr-xetc/rc.d/mountd5
-rw-r--r--etc/rc.d/zfs33
-rw-r--r--share/man/man5/rc.conf.59
5 files changed, 51 insertions, 2 deletions
diff --git a/etc/defaults/rc.conf b/etc/defaults/rc.conf
index 908d93e..fac7743 100644
--- a/etc/defaults/rc.conf
+++ b/etc/defaults/rc.conf
@@ -52,6 +52,9 @@ local_startup="/usr/local/etc/rc.d /usr/X11R6/etc/rc.d" # startup script dirs.
script_name_sep=" " # Change if your startup scripts' names contain spaces
rc_conf_files="/etc/rc.conf /etc/rc.conf.local"
+# ZFS support
+zfs_enable="NO" # Set to YES to automatically mount ZFS file systems
+
# Experimental - test before enabling
gbde_autoattach_all="NO" # YES automatically mounts gbde devices from fstab
gbde_devices="NO" # Devices to automatically attach (list, or AUTO)
diff --git a/etc/rc.d/Makefile b/etc/rc.d/Makefile
index aca2e20..ebc59a1 100755
--- a/etc/rc.d/Makefile
+++ b/etc/rc.d/Makefile
@@ -40,7 +40,8 @@ FILES= DAEMON FILESYSTEMS LOGIN NETWORKING SERVERS \
var virecover \
watchdogd wpa_supplicant \
ypbind yppasswdd ypserv \
- ypset ypupdated ypxfrd
+ ypset ypupdated ypxfrd \
+ zfs
.if ${MK_OPENSSH} != "no"
FILES+= sshd
diff --git a/etc/rc.d/mountd b/etc/rc.d/mountd
index 4389451..5edbb85 100755
--- a/etc/rc.d/mountd
+++ b/etc/rc.d/mountd
@@ -36,6 +36,11 @@ mountd_precmd()
checkyesno weak_mountd_authentication && rc_flags="-n"
fi
fi
+
+ if checkyesno zfs_enable ; then
+ rc_flags="${rc_flags} /etc/exports /etc/zfs/exports"
+ fi
+
rm -f /var/db/mountdtab
( umask 022 ; > /var/db/mountdtab )
return 0
diff --git a/etc/rc.d/zfs b/etc/rc.d/zfs
new file mode 100644
index 0000000..093f4c6
--- /dev/null
+++ b/etc/rc.d/zfs
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: zfs
+# REQUIRE: mountcritlocal
+# KEYWORD: nojail shutdown
+
+. /etc/rc.subr
+
+name="zfs"
+rcvar="zfs_enable"
+start_cmd="zfs_start"
+stop_cmd="zfs_stop"
+required_modules="zfs"
+
+zfs_start()
+{
+ zfs mount -a
+ zfs volinit
+ zfs share -a
+}
+
+zfs_stop()
+{
+ zfs unshare -a
+ zfs volfini
+ zfs unmount -a
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5
index 459e344..3caf681 100644
--- a/share/man/man5/rc.conf.5
+++ b/share/man/man5/rc.conf.5
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 4, 2007
+.Dd April 6, 2007
.Dt RC.CONF 5
.Os
.Sh NAME
@@ -1276,6 +1276,13 @@ By default, the files specified are
.Pa /etc/rc.conf
and
.Pa /etc/rc.conf.local
+.It Va zfs_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+.Pa /etc/rc.d/zfs
+will attempt to automatically mount ZFS file systems and initialize ZFS volumes
+(ZVOLs).
.It Va gbde_autoattach_all
.Pq Vt bool
If set to
OpenPOWER on IntegriCloud