swapon Command

Purpose

Activates a paging space.

Syntax

swapon -a | devicename 

Description

The swapon command activates a paging space. It is used during early system initialization to make the initial paging space available. During a later phase of system initialization, the swapon -a command is used to make other devices available so that paging and swapping activity is interleaved across several devices. If the option auto=yes then the swapon -a command makes all devices specified in the /etc/swapspaces available that aren't explicitly excluded from being automatically swapped on by their stanza. Calls to the swapon command normally occur in the system multiuser initialization /etc/rc file.

The devicename parameter specifies a specific device to be made available. The second form gives individual block devices as given in the system swap configuration table. The call makes this space and other defined spaces available to the system for paging and swap allocation. The system swap configuration table is the set of all devices specified in the /etc/swapspaces file.

You can use the Devices application in Web-based System Manager (wsm) to run this command.

Note: The maximum number of active paging spaces is 16. In addition, there is a paging space limit of 64 GB per device.

Note: This command is not supported when executed within a workload partition.

Flags

Item Description
-a Causes all devices present in the /etc/swapspaces file to be made available.

Security

The Role Based Access Control (RBAC) Environment and Trusted AIX®: This command implements and can perform privileged operations. Only privileged users can execute such privileged operations.

For more information about authorizations and privileges, refer to the RBAC: Privileged Command Database section in AIX Version 7.1 Security.

To review the list of privileges and the authorizations associated with this command, refer to the /etc/security/privcmds database.

Examples

  1. To cause all devices present in the /etc/swapspaces file to be made available, enter:

    swapon  -a

    All devices present in the /etc/swapspaces file are now available.
  2. To cause the /dev/paging03 and /dev/paging04 devices to be available for paging and swapping, enter:
    swapon /dev/paging03 /dev/paging04
    The /dev/paging03 and /dev/paging04 devices are now available.

Files

Item Description
/etc/rc System multiuser initialization
/dev/paging Device entries for paging/swap space
/etc/swapspaces Contains a list of swap devices.