6253 F_GETLK doesn't always return lock owner
[illumos-gate.git] / usr / src / man / man1m / swap.1m
blobb0fb586f5950683c6de6a5dd1d5d98344b4eaa0b
1 '\" te
2 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
3 .\" Copyright 1989 AT&T
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH SWAP 1M "Apr 11, 2008"
8 .SH NAME
9 swap \- swap administrative interface
10 .SH SYNOPSIS
11 .LP
12 .nf
13 \fB/usr/sbin/swap\fR \fB-a\fR \fIswapname\fR [\fIswaplow\fR] [\fIswaplen\fR]
14 .fi
16 .LP
17 .nf
18 \fB/usr/sbin/swap\fR \fB-d\fR \fIswapname\fR [\fIswaplow\fR]
19 .fi
21 .LP
22 .nf
23 \fB/usr/sbin/swap\fR \fB-l\fR [\fB-h\fR | \fB-k\fR]
24 .fi
26 .LP
27 .nf
28 \fB/usr/sbin/swap\fR \fB-s\fR [\fB-h\fR]
29 .fi
31 .SH DESCRIPTION
32 .sp
33 .LP
34 The \fBswap\fR utility provides a method of adding, deleting, and monitoring
35 the system swap areas used by the memory manager.
36 .SH OPTIONS
37 .sp
38 .LP
39 The following options are supported:
40 .sp
41 .ne 2
42 .na
43 \fB\fB-a\fR \fIswapname\fR [\fIswaplow\fR] [\fIswaplen\fR]\fR
44 .ad
45 .sp .6
46 .RS 4n
47 Add the specified swap area. This option can only be used by the superuser or
48 by one who has assumed the Primary Administrator role. \fIswapname\fR is the
49 name of the swap area or regular file. For example, on system running a UFS
50 root file system, specify a slice, such as \fB/dev/dsk/c0t0d0s1\fR, or a
51 regular file for a swap area. On a system running a ZFS file system, specify a
52 ZFS volume, such as \fB/dev/zvol/dsk/rpool/swap\fR, for a swap area. Using a
53 regular file for swap is not supported on a ZFS file system. In addition, you
54 cannot use the same ZFS volume for both the swap area and a dump device when
55 the system is running a ZFS root file system.
56 .sp
57 \fIswaplow\fR is the offset in 512-byte blocks into the file where the swap
58 area should begin. \fIswaplen\fR is the desired length of the swap area in
59 512-byte blocks. The value of \fIswaplen\fR can not be less than \fB16\fR. For
60 example, if \fIn\fR blocks are specified, then (\fIn\fR-1) blocks would be the
61 actual swap length. \fIswaplen\fR must be at least one page in length. The size
62 of a page of memory can be determined by using the \fBpagesize\fR command. See
63 \fBpagesize\fR(1). Since the first page of a swap file is automatically
64 skipped, and a swap file needs to be at least one page in length, the minimum
65 size should be a multiple of 2 pagesize bytes. The size of a page of memory is
66 machine-dependent.
67 .sp
68 \fIswaplow\fR + \fIswaplen\fR must be less than or equal to the size of the
69 swap file. If \fIswaplen\fR is not specified, an area will be added starting at
70 \fIswaplow\fR and extending to the end of the designated file. If neither
71 \fIswaplow\fR nor \fIswaplen\fR are specified, the whole file will be used
72 except for the first page. Swap areas are normally added automatically during
73 system startup by the \fB/sbin/swapadd\fR script. This script adds all swap
74 areas which have been specified in the \fB/etc/vfstab\fR file; for the syntax
75 of these specifications, see \fBvfstab\fR(4).
76 .sp
77 To use an \fBNFS\fR or local file system \fIswapname\fR, you should first
78 create a file using \fBmkfile\fR(1M). A local file system swap file can now be
79 added to the running system by just running the \fBswap\fR \fB-a\fR command.
80 For \fBNFS\fR mounted swap files, the server needs to export the file. Do this
81 by performing the following steps:
82 .RS +4
83 .TP
85 Add the following line to \fB/etc/dfs/dfstab\fR:
86 .sp
87 .in +2
88 .nf
89 share -F nfs -o \e
90 rw=\fIclientname\fR,root=\fIclientname path-to-swap-file\fR
91 .fi
92 .in -2
94 .RE
95 .RS +4
96 .TP
98 Run \fBshareall\fR(1M).
99 .RE
100 .RS +4
103 Have the client add the following line to \fB/etc/vfstab\fR:
105 .in +2
107 \fIserver\fR:\fIpath-to-swap-file\fR -  \fIlocal-path-to-swap-file\fR nfs \e
108      -\|-\|- \fIlocal-path-to-swap-file\fR -\|- swap -\|-\|-
110 .in -2
113 .RS +4
116 Have the client run \fBmount\fR:
118 .in +2
120 # mount \fIlocal-path-to-swap-file\fR
122 .in -2
126 .RS +4
129 The client can then run \fBswap\fR \fB-a\fR to add the swap space:
131 .in +2
133 # swap -a \fIlocal-path-to-swap-file\fR
135 .in -2
142 .ne 2
144 \fB\fB-d\fR \fIswapname\fR\fR
146 .sp .6
147 .RS 4n
148 Delete the specified swap area. This option can only be used by the super-user.
149 \fIswapname\fR is the name of the swap file: for example,
150 \fB/dev/dsk/c0t0d0s1\fR or a regular file. \fIswaplow\fR is the offset in
151 512-byte blocks into the swap area to be deleted. If \fIswaplow\fR is not
152 specified, the area will be deleted starting at the second page. When the
153 command completes, swap blocks can no longer be allocated from this area and
154 all swap blocks previously in use in this swap area have been moved to other
155 swap areas.
159 .ne 2
161 \fB\fB-h\fR\fR
163 .sp .6
164 .RS 4n
165 All sizes are scaled to a human readable format. Scaling is done by
166 repetitively dividing by 1024.
170 .ne 2
172 \fB\fB-k\fR\fR
174 .sp .6
175 .RS 4n
176 Write the files sizes in units of 1024 bytes.
180 .ne 2
182 \fB\fB-l\fR\fR
184 .sp .6
185 .RS 4n
186 List the status of all the swap areas. The output has five columns:
188 .ne 2
190 \fB\fBpath\fR\fR
192 .sp .6
193 .RS 4n
194 The path name for the swap area.
198 .ne 2
200 \fB\fBdev\fR\fR
202 .sp .6
203 .RS 4n
204 The major/minor device number in decimal if it is a block special device;
205 zeroes otherwise.
209 .ne 2
211 \fB\fBswaplo\fR\fR
213 .sp .6
214 .RS 4n
215 The \fIswaplow\fR value for the area in 512-byte blocks.
219 .ne 2
221 \fB\fBblocks\fR\fR
223 .sp .6
224 .RS 4n
225 The \fIswaplen\fR value for the area in 512-byte blocks.
229 .ne 2
231 \fB\fBfree\fR\fR
233 .sp .6
234 .RS 4n
235 The number of 512-byte blocks in this area that are not currently allocated.
238 The list does not include swap space in the form of physical memory because
239 this space is not associated with a particular swap area.
241 If \fBswap\fR \fB-l\fR is run while \fIswapname\fR is in the process of being
242 deleted (by \fBswap\fR\fB-d\fR), the string \fBINDEL\fR will appear in a sixth
243 column of the swap stats.
247 .ne 2
249 \fB\fB-s\fR\fR
251 .sp .6
252 .RS 4n
253 Print summary information about total swap space usage and availability:
255 .ne 2
257 \fB\fBallocated\fR\fR
259 .sp .6
260 .RS 4n
261 The total amount of swap space in bytes currently allocated for use as backing
262 store.
266 .ne 2
268 \fB\fBreserved\fR\fR
270 .sp .6
271 .RS 4n
272 The total amount of swap space in bytes not currently allocated, but claimed by
273 memory mappings for possible future use.
277 .ne 2
279 \fB\fBused\fR\fR
281 .sp .6
282 .RS 4n
283 The total amount of swap space in bytes that is either allocated or reserved.
287 .ne 2
289 \fB\fBavailable\fR\fR
291 .sp .6
292 .RS 4n
293 The total swap space in bytes that is currently available for future
294 reservation and allocation.
297 These numbers include swap space from all configured swap areas as listed by
298 the \fB-l\fR option, as well swap space in the form of physical memory.
301 .SH USAGE
304 On the 32-bit operating system, only the first 2 Gbytes -1 are used for swap
305 devices greater than or equal to 2 Gbytes in size. On the 64-bit operating
306 system, a block device larger than 2 Gbytes can be fully utilized for swap up
307 to 2^63 \(mi1 bytes.
308 .SH ENVIRONMENT VARIABLES
311 See \fBenviron\fR(5) for descriptions of the following environment variables
312 that affect the execution of \fBswap\fR: \fBLC_CTYPE\fR and \fBLC_MESSAGE\fR.
313 .SH SEE ALSO
316 \fBpagesize\fR(1), \fBmkfile\fR(1M), \fBshareall\fR(1M), \fBgetpagesize\fR(3C),
317 \fBvfstab\fR(4), \fBattributes\fR(5), \fBlargefile\fR(5)
318 .SH NOTES
321 For information about setting up a swap area with \fBZFS\fR, see the \fIZFS
322 Administration Guide\fR.
323 .SH WARNINGS
326 No check is done to determine if a swap area being added overlaps with an
327 existing file system.