Add support for mounting zfs filesystems to mountall script. ZFS configuration
is stored in /etc/zpool.cache and it is automatically loaded to kernel from filesystem. Filesystems are then configured accordingly to their properties loaded from cache file.
This commit is contained in:
parent
fbd1c01117
commit
cc9255a89b
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $NetBSD: mountall,v 1.6 2008/12/01 14:47:14 tsutsui Exp $
|
||||
# $NetBSD: mountall,v 1.7 2009/10/05 22:39:27 haad Exp $
|
||||
#
|
||||
|
||||
# REQUIRE: mountcritremote named ypbind
|
||||
@ -9,8 +9,40 @@
|
||||
$_rc_subr_loaded . /etc/rc.subr
|
||||
|
||||
name="mountall"
|
||||
start_cmd="echo 'Mounting all filesystems...'; mount -a"
|
||||
stop_cmd="echo 'Unmounting all filesystems...'; umount -a"
|
||||
start_cmd="mountall_start"
|
||||
stop_cmd="mountall_stop"
|
||||
|
||||
mountall_start()
|
||||
{
|
||||
echo 'Mounting all filesystems...'
|
||||
if [ -f /etc/zfs/zpool.cache ]; then
|
||||
# Get ZFS module loaded (and thereby, zvols created).
|
||||
zfs list > /dev/null 2>&1
|
||||
# Mount file systems noted in fstab.
|
||||
mount -a
|
||||
# Mount ZFS file systems.
|
||||
zfs mount -a
|
||||
else
|
||||
# Mount file systems noted in fstab.
|
||||
mount -a
|
||||
fi
|
||||
}
|
||||
|
||||
mountall_stop()
|
||||
{
|
||||
echo 'Unmounting all filesystems...'
|
||||
if [ -f /etc/zfs/zpool.cache ]; then
|
||||
# Unmount ZFS file systems.
|
||||
zfs unmount -a
|
||||
# Unmount file systems noted in fstab.
|
||||
umount -a
|
||||
# Unload ZFS module, so disk devices are closed.
|
||||
modunload zfs
|
||||
else
|
||||
# Otherwise, just deal with fstab.
|
||||
umount -a
|
||||
fi
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
||||
|
Loading…
Reference in New Issue
Block a user