在unix系统下,交换空间就是我们常说的虚拟内存。
在AIX系统下,交换空间分配一般遵循以下原则:
# Only one paging space per disk;
# Use disks with the least activity;
# Paging spaces roughly the same size;
# Do not extend paging space to multiple physical volumes;
# Use multiple disk controllers;
# AIX交换空间常用管理命令
1.AIX查看交换空间使用情况(lsps):
用lsps -a 查看aix所有交换空间的信息
$ lsps -a
Page Space Physical Volume Volume Group Size %Used Active Auto Type
hd6 hdisk0 rootvg 16384MB 37 yes yes lv
用lsps -s查看aix交换空间的使用情况:
$ lsps -s
Total Paging Space Percent Used
16384MB 37%
2.AIX查看系统启动时激活的交换空间
#cat /etc/swapspaces
$ cat /etc/swapspaces
* /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
3.AIX创建交换空间(mkps)
AIX创建交换空间,可以用smit或mkps命令来完成,mkps命令格式如下:
mkps [-a] [-n] [-t type] -s NumLPs Vgname Pvname
Vgname 交换空间所在的卷组(volume group)名
Pvname 交换空间所在的物理卷(physical volume)名
-s NumLPs 交换空间所占用的逻辑分区(logical partition)数
-a 在下次系统启动时激活该交护岸空间 (将该交换空间加入到/etc/swapspaces文件中)
-n 立即激活该交换空间
-t type 指定交换空间类型(lv或者nfs)
也可以通过smitty mkps命令来创建:
#smitty mkps
Add Another Paging Space
Type or select values in entry fields.
Press Enter AFTER making all desired changes.
[Entry Fields]
Volume group name rootvg
SIZE of paging space (in logical partitions) [] #
PHYSICAL VOLUME name +
Start using this paging space NOW? no +
Use this paging space each time the system is no +
RESTARTED?
F1=Help F2=Refresh F3=Cancel F4=List
Esc+5=Reset Esc+6=Command Esc+7=Edit Esc+8=Image
Esc+9=Shell Esc+0=Exit Enter=Do
以下命令在名字为rootvg的卷组中创建一个大小为40个逻辑分区大小的交换空间,在创建完成后立即激活该交换空间,并且在下次系统启动时激活该交换空间:
# mkps -s 40 -n -a rootvg
改命令执行后,系统中会增加一个名字为/dev/pagingnn的一个交换空间,其中nn是一个顺序号,例如00、01等。
4.AIX激活/关闭交换空间
如果交换空间在创建时没有激活,可以使用如下命令激活:
#swapon /dev/paging00
Swap –a命令可以激活/etc/swapspaces中定义的所有交换空间,该命令一般在系统启动时自动执行。
如下命令可以使一个已经激活的交换空间变为非激活:
#swapoff /dev/paging00
5.AIX交换空间修改
AIX中可以使用chps对交换空间进行修改(也可以通过smitty chps来做)
#chps –d 1 paging00 #从交换空间paging00中删除1个LP;
#chps –s 1 paging00 #给交换空间paging00中增加1个LP;
smitty chps修改交换空间:
Change / Show Characteristics of a Paging Space
Type or select values in entry fields.
Press Enter AFTER making all desired changes.
[Entry Fields]
Paging space name paging00
Volume group name sjkbkvg
Physical volume name hdiskpower144
NUMBER of additional logical partitions [] #
Or NUMBER of logical partitions to remove [] #
Use this paging space each time the system is no +
RESTARTED?
F1=Help F2=Refresh F3=Cancel F4=List
Esc+5=Reset Esc+6=Command Esc+7=Edit Esc+8=Image
Esc+9=Shell Esc+0=Exit Enter=Do
6.AIX删除交换空间
AIX删除交换空间可以使用rmps命令(也可以使用smitty rmps)
#rmps paging00
删除一个交换空间之前,该交换空间必须是非激活状态。
smitty rmps删除交换空间:
Remove a Paging Space
Type or select values in entry fields.
Press Enter AFTER making all desired changes.
[Entry Fields]
PAGING SPACE name paging00 +
F1=Help F2=Refresh F3=Cancel F4=List
Esc+5=Reset Esc+6=Command Esc+7=Edit Esc+8=Image
Esc+9=Shell Esc+0=Exit Enter=Do
收起