3 # Add additional swap files
9 # REQUIRE: FILESYSTEMS kld
11 # KEYWORD: nojail shutdown
16 start_cmd="addswap_start"
17 stop_cmd="addswap_stop"
25 if [ -w "${swapfile}" ]; then
26 check_startmsgs && echo "Adding ${swapfile} as additional swap"
28 if [ -n "${swapfile_mdunit}" ]; then
29 mdev="/dev/md${swapfile_mdunit#md}"
30 mdconfig -a -t vnode -f "${swapfile}" -u ${swapfile_mdunit}
32 mdev="/dev/`mdconfig -a -t vnode -f "${swapfile}"`"
38 echo "error creating swapfile device"
51 if [ -n "${swapfile_mdunit}" ]; then
52 mdev="/dev/md${swapfile_mdunit#md}"
54 mdev="/dev/`mdconfig -lv | grep "${swapfile}" | cut -f1`"
55 swapfile_mdunit=${mdev#md}
57 if [ -n "${swapfile_mdunit}" ]; then
58 swapctl -l | grep -q ${mdev}
60 echo "Dismounting swapfile ${swapfile}"
61 swapoff ${mdev} && mdconfig -d -u ${swapfile_mdunit}