Thursday 26 December 2013

Practical Guide To AIX "Paging Space Management"

In this article we are going to discuss about , how to manage paging in AIX OS.

Contents:

1. Create/Add Paging Space

To add paging space we need to use "mkps" command. Equivalent smitty faspath command is "smitty mkps".
There will be an entry added in "/etc/swapspaces" file when you create a paging space if you mention  optiion "-a".

mkps [ -t lv | [ps_helper psname] ] [ -a ] [ -n ] [-c ChksumSize]-s LogicalPartitions VolumeGroup [ PhysicalVolume ]

Eg:

To create a paging space in volume group myvg that has four logical partitions and is activated immediately and at all subsequent system restarts, enter:
#mkps  -a  -n  -s4 myvg

  • These are "man lsps options"

    Item Description
    -a Specifies that the paging space is configured at subsequent restarts.
    -c Specifies the size of the checksum to use for the paging space, in bits. Valid options are 0 (checksum disabled), 8, 16 and 32. If -c is not specified it will default to 0.
    -n Activates the paging space immediately.
    -s LogicalPartitions Specifies the size of the paging space and the logical volume to be made in logical partitions.
    -t Specifies the type of paging space to be created. One of the following variables is required: 
    lv
    Specifies that a paging space of type logical volume should be created on the system.
    nfs
    Specifies that a paging space of type NFS should be created on the system.
    ps_helper
    Name of the helper program for a third party device.
    psname
    Name of the device entry for paging space.

Example /etc/swapspaces file:

# cat  /etc/swapspacesExample /etc/swapspaces file:
* /etc/swapspaces
*
* This file lists all the paging spaces that are automatically put into
* service on each system restart (the 'swapon -a' command executed from
* /etc/rc swaps on every device listed here).
*
* WARNING: Only paging space devices should be listed here.
*
* This file is modified by the chps, mkps and rmps commands and referenced
* by the lsps and swapon commands.

hd6:
        dev = /dev/hd6

paging00:
        dev = /dev/paging00

paging01:
        dev = /dev/paging01

2. List Paging Space:

The lsps command displays the characteristics of paging spaces, such as the paging space name, physical volume name, volume group name, size, percentage of the paging space used, whether the space is active or inactive, and whether the paging space is set to automatic.

Equivalent smitty faspath command is "smitty lsps".

lsps { -s | [ -c | -l ] { -a | -t { lv | nfs | ps_helper} | PagingSpace } }

The following examples show the use of lsps command with various flags to obtain the paging space information. The -c flag will display the information in colon format and paging space size in physical partitions.
# lsps -a -c
#Psname:Pvname:Vgname:Size:Used:Active:Auto:Type
paging00:hdisk1:rootvg:20:1:y:y:lv
hd6:hdisk1:rootvg:64:1:y:y:lv

# lsps -a
Page Space  Physical Volume   Volume Group    Size   %Used  Active  Auto  Type
paging00    hdisk1            rootvg          80MB       1     no   yes    lv
hd6         hdisk1            rootvg         256MB       1     yes   yes    lv

# lsps -s
Total Paging Space   Percent Used
      256MB               1%

To display the characteristics of paging space myps using the helper program foo enter the following commad:
lsps -t foo myps

This displays the characteristics for all paging spaces and provides a listing similar to the following listing:
Page Space      Physical Volume   Volume Group    Size %Used Active  Auto  Type
myps             mydisk            myvg            512MB     1    yes   yes    lv

3. Change Paging Space:

You can change only the following two attributes for a paging space logical volume.

chps [ -s LogicalPartitions | -d LogicalPartitions ] [ -a { y | n } ] PagingSpace

Increasing Paging Space:

Eg:
#chps -s xx yyy (Where xx is the number of logical partitions to add and yyy identifies the logical volume)

#chps -s 10 hd6   ( adds 10 logical partitions to the logical volume hd6, which results in adding 1280 Mb ( lp size=128MB) to the paging space)

Decrease/Shrink Paging Space:

# chps -d 4 hd6
shrinkps: Temporary paging space paging00 created.
shrinkps: Dump device moved to temporary paging space.
shrinkps: Paging space hd6 removed.
shrinkps: Paging space hd6 recreated with new size.
shrinkps: Resized and original paging space characteristics differ,
check the lslv command output.

Note:You should not shrink the paging beyond the system requirement to avoid system crash.

Activate or deactivate a paging space for the next reboot:

To define the paging00 paging space as configured and active at subsequent system restarts,
chps -a -y  paging00

To define the paging00 paging space as configured and inactive at subsequent system restarts,
chps -a -n  paging00

4. Activate or deactivate a paging space:

"swapon" is the command used to activate the currently defined inactive paging. When a "swapon" ran on a particular paging space it will read the details from the
file "/etc/swapspaces"

swapon -a | devicename 

Examples:
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.

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.

Inorder to make the paging space active , you need to use "swapoff" command.
swapoff DeviceName { DeviceName ...}

5. Remove paging space:

The rmps command removes an inactive paging space, means whenever you  need to remove a paging space you should make it inactive by using "swapoff".

rmps[ -t ps_helper] PagingSpace

Examples:
To remove PS01 paging space, run the following command:
#rmps PS01

This removes the PS01 paging space.


1 comment: