1 .\" $NetBSD: swapctl.8,v 1.40 2008/05/29 14:51:25 mrg Exp $
3 .\" Copyright (c) 1997 Matthew R. Green
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
20 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
22 .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 .Dd September 24, 2009
33 .Nd system swap management tool
40 .Op Fl t Ar blk|noblk|auto
46 .Op Fl t Ar blk|noblk|auto
60 .Op Fl k | Fl m | Fl g | Fl h
73 program adds, removes,
74 lists and prioritizes swap devices and files for the system.
77 program acts the same as the
79 program, as if called with the
93 The following options are available:
94 .Bl -tag -width 123456
100 file for devices and files with a
106 type entries as swap devices and sets the last
108 type entry as the dump device.
109 If no swap devices are configured,
111 will exit with an error code.
112 If used together with
114 this option will not read
116 but query the kernel for all swap partitions on local hard disks.
120 option requires that a
122 also be in the argument list.
125 is added to the kernel's list of swap devices using the
130 form of this command, the
132 option is treated the same as the
134 option, for backwards compatibility.
138 option changes the priority of the listed swap device or file.
142 option requires that a
144 also be in the argument list.
145 The kernel dump device is set to
149 can be used instead of a
151 to disable the currently set dump device.
152 This change is made via the
155 The dump device is used when the system crashes
156 to write a current snapshot of real memory, to be saved later with
158 at system reboot, and analyzed to determine the problem.
162 option removes the listed
164 from the kernel's list of swap devices or files.
166 Used in combination with the
170 flag this option makes
172 use the first discovered swap device to also become the dump device.
175 option is mutually exclusive with the
181 option uses (1024 * 1024 * 1024) byte blocks instead of the default 512 byte.
186 .Xr humanize_number 3
187 to display the sizes.
191 option uses 1024 byte blocks instead of the default 512 byte.
195 option lists the current swap devices and files, and their usage statistics.
199 option uses (1024 * 1024) byte blocks instead of the default 512 byte.
209 print the action it would take, but not actually change any swap or
218 find the first swap device and configure it as dump device.
219 No swap device is changed.
220 This option needs to be used in combination with
222 and is mutually exclusive with
227 option sets the priority of swap devices or files to the
240 checking for any defined swap or dump devices.
243 returns with an exit status of 0, if none are found the exit status will
248 option displays a single line summary of current swap statistics.
250 This flag modifies the function of the
257 option allows the type of device to add to be specified.
260 causes all block devices in
265 causes all non-block devices in
270 causes all swap partitions on local hard disks to be used.
271 This option is useful in early system startup, where swapping
272 may be needed before all file systems are available, such as during
273 disk checks of large file systems.
279 file for devices and files with a
281 type, and remove all these entries as swap devices.
282 If no swap devices are unconfigured,
284 will exit with an error code.
285 If used together with
287 this option will not read
289 but unconfigure all local swap partitions.
293 option displays the current dump device.
298 swap system allows different swap devices and files to be assigned different
299 priorities, to allow the faster resources to be used first.
300 Swap devices at the same priority are used in a round-robin fashion until
301 there is no more space available at this priority, when the next priority
303 The default priority is 0, the highest.
304 This value can be any valid integer,
305 with higher values receiving less priority.
309 file for swap devices, the following options are recognized:
311 .Bl -tag -width nfsmntpt=/path -compact
313 This option sets the priority of the specified swap device to N.
315 This option is useful for swapping to NFS files.
316 It specifies the local mount point to mount an NFS filesystem.
317 The mount point must exist as a directory.
318 Typically, once this mount has succeeded, the file to be used for swapping
319 on will be available under this point mount.
322 server:/export/swap/client none swap sw,nfsmntpt=/swap
326 If the requested operation was successful, the
328 utility exits with status 0.
329 If an error occurred, the exit status is 1.
335 operations (add or remove swap devices listed in
337 return an exit status of 2
338 to report that no suitable swap devices were found.
342 operation (query dump device) and
344 (list swap partitions) return an exit status of 1 if no dump device or
345 swap partition has been configured.
346 If any swap partition is available or
347 a dump device is set, the respective query returns 0.
355 program was first made available in
359 program, provided for backwards compatibility, appeared in
364 program was written by
365 .An Matthew R. Green Aq mrg@eterna.com.au .
367 Using the automatic swap partition detection done by the
369 option may be dangereous.
370 Depending on the on-disk partitioning scheme used, the type of a partition
371 may not be accurately recognizable as a swap partition.
372 The autodetection might recognize and use partitions on
373 removable media like USB sticks.
374 An easy way to test the autoconfiguration is to use
380 If no swap information is specified in
382 the system startup scripts (see
384 will configure no swap space and your machine will behave very badly
385 if (more likely when) it runs out of real memory.
387 Local and remote swap files cannot be configured until after the file
388 systems they reside on are mounted read/write.
389 The system startup scripts need to
391 all local file systems before this can happen.
392 This process requires substantial amounts of memory on some systems.
393 If you configure no local block swap devices on a machine that has local
394 file systems to check and rely only on swap files, the machine will have
395 no swap space at all during system
397 and may run out of real memory, causing fsck to abnormally exit and
398 startup scripts to fail.