HP-UX Reference (11i v2 07/12) - 1M System Administration Commands N-Z (vol 4)

s
swapon(1M) swapon(1M)
reserve can be specified in the same forms as limit, above.
-t type Restrict the type of the paging area. If the
-t option is omitted, all of the paging
areas defined in
/etc/fstab are made available. type can have one of the following
values:
dev Device paging areas.
fs File system paging areas.
local Paging areas defined on the local system.
remote Paging areas defined on remote systems.
-u Unlock block device files which are being used by the
savecrash command. Nor-
mally,
swapon will not enable paging on a device if it is being used by
savecrash
to retrieve system dump information. The list of devices in use is maintained in the
file
/etc/savecrash.LCK
. This option forces the device to be enabled, which
may overwrite any system dump information contained on the device. This option
should be used with extreme caution.
RETURN VALUE
swapon returns one of the following values:
0 Successful completion.
>0 An error condition occurred.
EXAMPLES
The first two examples enable paging to the file system containing the /paging directory. The maximum
number of file system blocks available to the paging system is set to 5000, the number of file system blocks
reserved for file system use only is set to 10000, and the priority is set to 2. The number of file system
blocks initially taken by the paging system defaults to 0 in the first example, and is set to 0 in the second
example. On a file system with the default 8kB block size, these examples allocate approximately 40MB of
file system paging.
/usr/sbin/swapon -l 5000 -r 10000 -p 2 /paging
/usr/sbin/swapon /paging 0 5000 10000 2
This example enables paging to two block devices and sets the priority of both devices to 0.
/usr/sbin/swapon -p 0 /dev/dsk/c10t0d0 /dev/dsk/c13t0d0
This example enables paging to a block device, using the space after the end of the file system for paging
and letting the priority default to 1.
/usr/sbin/swapon -e /dev/dsk/c4t0d0
This example enables paging to a block device, forcing paging even if a file system exists on the device.
/usr/sbin/swapon -f /dev/dsk/c12t0d0
WARNINGS
On systems running VxVM 3.5, the swap volumes to be configured for system crash dumps should be
created with the usage type as swap during the creation of the swap volume. Not doing so will cause
dump corruption. You could use the -U option of vxassist(1M) to do the same.
Once file system blocks have been allocated for paging space, the file system cannot be unmounted unless
the system is rebooted.
If any paging area becomes unavailable while the system is running, for example if a network failure occurs
while paging to a remote system, the system will immediately halt.
The file system block size used by the -l, -m, and -r options varies between file systems, and is defined by
the system administrator at the time the file system is created. The dumpfs command can be used to
determine the block size for a particular file system (see dumpfs(1M)).
When using the -l and -r options, the reserve space specified by the -r option takes precedence over the
-l option. Thus, if:
D = Total disk space available to ordinary users
R = Reserve space specified by the -r option
HP-UX 11i Version 2: December 2007 Update 3 Hewlett-Packard Company 431