diff --git a/etc/rc.d/swaplate b/etc/rc.d/swaplate index f335481b6e47..fbfae2ad9bfe 100755 --- a/etc/rc.d/swaplate +++ b/etc/rc.d/swaplate @@ -12,7 +12,7 @@ name="swaplate" desc="Setup late swap space" start_cmd='/sbin/swapon -aLq' -stop_cmd='/sbin/swapoff -aq' +stop_cmd='/sbin/swapoff -aLq' load_rc_config swap run_rc_command "$1" diff --git a/sbin/swapon/swapon.8 b/sbin/swapon/swapon.8 index ffce7d9db46e..51bee68346b6 100644 --- a/sbin/swapon/swapon.8 +++ b/sbin/swapon/swapon.8 @@ -28,7 +28,7 @@ .\" @(#)swapon.8 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd October 2, 2016 +.Dd October 21, 2016 .Dt SWAPON 8 .Os .Sh NAME @@ -98,6 +98,12 @@ will be removed, unless their .Dq noauto option is also set. If the +.Fl L +option is specified, +only swap devices with the +.Dq late +option will be removed. +If the .Fl q option is used, informational messages will not be diff --git a/sbin/swapon/swapon.c b/sbin/swapon/swapon.c index e34cfcf171bf..052fbc734afb 100644 --- a/sbin/swapon/swapon.c +++ b/sbin/swapon/swapon.c @@ -176,6 +176,10 @@ main(int argc, char **argv) strstr(fsp->fs_mntops, "late") && late == 0) continue; + if (which_prog == SWAPOFF && + strstr(fsp->fs_mntops, "late") == NULL && + late != 0) + continue; swfile = swap_on_off(fsp->fs_spec, 1, fsp->fs_mntops); if (swfile == NULL) {