Commit Graph

41 Commits

Author SHA1 Message Date
Konstantin Belousov
1aa249c935 swapoff(8): add -f flag
to force swapout by ignoring the heuristic that calculates amount of
allocated memory against total of RAM plus remaining swap.

Reviewed by:	markj
Discussed with:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33165
2021-12-05 00:20:58 +02:00
Benedict Reuschling
acace3175c The -F flag of swapon(8) requires -a to work.
Before this change, swapon(8) implied that -F works as a standalone option,
which is not the case and would produce a usage message. This change extends
the description of the -F option to mention that -a is required with it.

PR:		238551
Submitted by:	Christian Baltini
MFC after:	5 days
2020-05-19 12:16:44 +00:00
Doug Moore
504f5e294e swap_pager.c reserves 2 blocks for a bsd label. Change that 2 to the
expression howmany(BBSIZE, PAGE_SIZE), where BBSIZE is the size of the
boot block area.  That can be less than 2 if PAGE_SIZE is big.

swapon(8) has an option to trim (delete) all the blocks of a device at
startup.  However, if the first of those blocks is a bsd label, then
trimming those blocks is destructive.  Change swapon to leave the
first BBSIZE bytes untrimmed.

Update manual pages to reflect changes in how swapon and how it may be
used, espeically in association with savecore.

Reviewed by: alc
Approved by: markj (mentor)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D21191
2019-08-15 02:30:44 +00:00
Doug Moore
a616b25342 Modify swapon(8) to invoke BIO_DELETE to trim swap devices, either if
'-E' appears on the swapon command line, or if "trimonce" appears as
an fstab option.

Discussed at: BSDCAN
Tested by: markj
Reviewed by: markj
Approved by: markj (mentor)
Differential Revision:https://reviews.freebsd.org/D20599
2019-06-22 03:16:01 +00:00
Warner Losh
fbbd9655e5 Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-02-28 23:42:47 +00:00
Jilles Tjoelker
7627b33010 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
Jilles Tjoelker
a7d1d41617 swapon(8): Update to reality: swapoff ignores -L and the late option in fstab.
MFC after:	1 week
2016-10-02 15:01:31 +00:00
Sergey Kandaurov
5cd4723c5c - Purge one more reference to ad(4)[1].
- NSWAPDEV limit has gone.

Noticed by:	Sergey V. Dyatko [1]
MFC after:	1 week
2013-11-22 12:09:15 +00:00
Hiroki Sato
268a55bc98 - Add vnode-backed swap space specification support. This is enabled when
device names "md" or "md[0-9]*" and a "file" option are specified in
  /etc/fstab like this:

  md    none    swap    sw,file=/swap.bin       0       0

- Add GBDE/GELI encrypted swap space specification support, which
  rc.d/encswap supported.  The /etc/fstab lines are like the following:

  /dev/ada1p1.bde       none    swap    sw      0       0
  /dev/ada1p2.eli       none    swap    sw      0       0

  .eli devices accepts aalgo, ealgo, keylen, and sectorsize as options.

  swapctl(8) can understand an encrypted device in the command line
  like this:

  # swapctl -a /dev/ada2p1.bde

- "-L" flag is added to support "late" option to defer swapon until
  rc.d/mountlate runs.

- rc.d script change:

    rc.d/encswap -> removed
    rc.d/addswap -> just display a warning message if $swapfile is defined
    rc.d/swap1 -> renamed to rc.d/swap
    rc.d/swaplate -> newly added to support "late" option

These changes alleviate a race condition between device creation/removal
and swapon/swapoff.

MFC after:	1 week
Reviewed by:	wblock (manual page)
2013-06-27 18:28:45 +00:00
Maxim Sobolev
633d2bc579 Add new option -F to specify alternative location of the /etc/fstab
file.

MFC after:	1 month
2011-10-25 01:47:33 +00:00
Mike Makonnen
45a5dc937d Add a -q flag to swapon(8) to suppress informational messages. Use it in
rc.d.
Note: errors are not affected by this flag.
2008-06-23 22:17:08 +00:00
Pawel Jakub Dawidek
2e64768c87 - Change the meaning of -h flag from giving the output in megabytes to
giving the output in a human-readable form. This behaviour is consistent
  with most of system tools.
- Add -m and -g options to give output in megabytes and gigabytes
  respectively.
2008-05-20 12:24:31 +00:00
Ruslan Ermilov
8d646af581 Sync program's usage() with manpage's SYNOPSIS. 2005-02-10 09:19:34 +00:00
Ruslan Ermilov
6087df9e8b Sort sections. 2005-01-18 10:09:38 +00:00
Mark Murray
4c723140a4 Remove advertising clause from University of California Regent's license,
per letter dated July 22, 1999.

Approved by: core, imp
2004-04-09 19:58:40 +00:00
Giorgos Keramidas
f5b4f7c9eb Spell "utilities" correctly. 2003-02-28 00:55:18 +00:00
Ruslan Ermilov
15f6525003 More fixes.
Submitted by:	Andy Farkas <andyf@speednet.com.au>
Reviewed by:	das
2003-02-25 07:41:33 +00:00
Ruslan Ermilov
031e8f07e9 mdoc(7) police: Tidy up. 2003-02-24 23:02:37 +00:00
David Schultz
1281f763a9 Clarify about NSWAPDEV, add a DIAGNOSTICS section pointing to
swapon(2), and correct HISTORY.

Reviewed by:	mike (mentor)
2003-02-24 08:52:06 +00:00
Matthew Dillon
a420c8119a Add 'swapctl' - as a hardlink to swapon/swapoff, and augment swapon with
swapctl functionality.  The idea is to create a swapctl command that is
fairly close to the OpenBSD and NetBSD version.  FreeBSD does not implement
swap priority (and it would be a mistake if we did) so we didn't bother with
that part of it.

Submitted by:	Eirik Nygaard <eirikn@bluezone.no>
Augmented by:	dillon (extensively)
Reviewed by:	David Schultz <dschultz@uclink.Berkeley.EDU>
2002-12-28 23:39:47 +00:00
Matthew Dillon
92da00bb24 This is David Schultz's swapoff code which I am finally able to commit.
This should be considered highly experimental for the moment.

Submitted by:	David Schultz <dschultz@uclink.Berkeley.EDU>
MFC after:	3 weeks
2002-12-15 19:17:57 +00:00
Tom Rhodes
ce66ddb763 s/filesystem/file system/g as discussed on -developers 2002-08-21 18:11:48 +00:00
Philippe Charnier
629e80effb The .Nm utility. 2002-07-06 19:35:14 +00:00
Ruslan Ermilov
9fe48c6e8d mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 11:04:34 +00:00
Ruslan Ermilov
7e3ba257a8 vnconfig(8) -> mdconfig(8). 2001-04-10 16:29:41 +00:00
Ruslan Ermilov
7c7fb079b9 mdoc(7) police: use the new features of the Nm macro. 2000-11-20 16:52:27 +00:00
Gregory Sutter
9eac7384ba correct wording in BUGS section; it's not possible to dismount swap
devices, but it's certainly possible to make use of them.

PR:		17013
Submitted by:	Giorgos Keramidas <keramida@ceid.upatras.gr>
2000-02-28 21:29:37 +00:00
Nik Clayton
7e6fca8523 Mention /dev/vn0b and /dev/vntab. ascii -> ASCII transform had
already happened in an earlier commit.

PR:             docs/13645
Submitted by:   Stephen Roznowski <sjr@home.com>
1999-09-26 00:05:45 +00:00
Alexey Zelkin
c6d6e7726f Correct spelling : ascii -> ASCII
PR:		docs/13702
Submitted by:	Stephen J. Roznowski <sjr@home.com>
Reviewed by:	mpp
1999-09-20 09:15:23 +00:00
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Joseph Koshy
9c4134e136 Refer to current names for swap partitions in the `FILES' section.
PR:		docs/11709
Submitted by:	Matthew D. Fuller <fullermd@over-yonder.net>
1999-05-17 05:19:13 +00:00
Philippe Charnier
e798a806ce .Nm swapon -> .Nm.
Sort #includes. Add rcsid.
1998-08-03 06:35:01 +00:00
Steve Price
84b9f7a718 Revert last commit and SEE ALSO pstat(8) instead.
Submitted by:	Bruce Evans
1998-02-01 06:46:37 +00:00
Steve Price
1717267a28 SEE ALSO swapinfo(8).
PR:		5447
Submitted by:	Craig Leres <leres@ee.lbl.gov>
1998-01-25 17:28:52 +00:00
Warner Losh
c9c3deeddc .Xr vnconfig 8. This was suggested by Dworkin Muller <dworkin@village.org>
when he tried to figure out how to swap to a file and had to ask me for
help.
1997-08-26 00:32:06 +00:00
Peter Wemm
c0ec1f37ef Revert $FreeBSD$ to $Id$ 1997-02-22 14:40:44 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Wolfram Schneider
e0e5145ce6 add missing comma(s) in .Xr macros 1996-09-23 22:24:39 +00:00
Jordan K. Hubbard
7fc4a454e2 Make the noauto flag usable for swap devices too. Closes PR#1542
Submitted-By: David Leonard <d@scry.dstc.edu.au>
1996-09-06 06:01:05 +00:00
Jordan K. Hubbard
571a258ad5 fstab is in section 5, not section 8.
Obtained from: NetBSD
1995-02-17 03:37:33 +00:00
Rodney W. Grimes
8fae3551ec BSD 4.4 Lite sbin Sources
Note:  XNSrouted and routed NOT imported here, they shall be imported with
usr.sbin.
1994-05-26 06:35:07 +00:00