freebsd-skq/etc/rc.d/swaplate
jilles 961d4ea064 swapoff: Remove only late devices with -aL.
Currently, '/etc/rc.d/swaplate stop' removes all swap devices. This can be
very slow and may not even be possible if there is a lot of swap space in
use. However, removing swap devices is only needed for late swap devices
that may depend on daemons that subsequent shutdown steps stop. Normal swap
devices such as hard disk partitions will remain available throughout the
shutdown process and need not be removed.

In swapoff, interpret -aL to remove late swap devices only, and use this in
etc/rc.d/swaplate. The meaning of -aL in swapon remains unchanged (add all
swap devices, both normal and late).

PR:		187081
Reviewed by:	wblock (man page only), ngie
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D8126
2016-10-21 21:55:50 +00:00

19 lines
258 B
Bash
Executable File

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: swaplate
# REQUIRE: mountlate
# KEYWORD: nojail shutdown
. /etc/rc.subr
name="swaplate"
desc="Setup late swap space"
start_cmd='/sbin/swapon -aLq'
stop_cmd='/sbin/swapoff -aLq'
load_rc_config swap
run_rc_command "$1"