AIX培訓筆記——交換空間

shilei1發表於2012-04-25
交換空間,也即作業系統中的虛擬記憶體,本文簡單介紹了一些交換空間管理的基本命令。
交換空間分配原則:
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;
檢視交換空間使用情況:
#lsps -a
Page Space Physical Volume Volume Group Size %Used Active Auto Type
paging00 hdisk4 rootvg 8192MB 31 yes yes lv
hd6 hdisk3 rootvg 8192MB 31 yes yes lv
檢視實體記憶體數:
#lsattr -El sys0 -a realmem
realmem 33554432 Amount of usable physical memory in Kbytes False
或者:
#lsattr -El mem0
goodsize 32768 Amount of usable physical memory in Mbytes False
size 32768 Total amount of physical memory in Mbytes False
檢視系統啟動時啟用的交換空間:
#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
paging00:
dev = /dev/paging00
對以下資訊需要特別注意,一旦發現,應立即通知系統管理員進行處理:
"INIT: Paging space is low"
"ksh: cannot fork no swap space"
"Not enough memory"
"Fork function failed"
"fork () system call failed"
"Unable to fork, too may processes"
"Fork failure - not enough memory available"
"Fork function not allowed. Not enough memory available."
"Cannot fork: Not enough space"
如何建立交換空間,可以用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)
以下命令在名字為rootvg的卷組(volume group)中建立一個大小為4個邏輯分割槽(logical partition)大小的交換空間,在建立完成後立即啟用該交換空間,並且在下次系統啟動時啟用該交換空間:
# mkps -s 4 -n -a rootvg
改命令執行後,系統中會增加一個名字為/dev/pagingnn的一個交換空間,其中nn是一個順序號,例如00、01等。
如果交換空間在建立時沒有啟用,可以使用如下命令啟用:
#swapon /dev/paging00
Swap –a命令可以啟用/etc/swapspaces中定義的所有交換空間,該命令一般在系統啟動時自動執行。
如下命令可以使一個已經啟用的交換空間變為非啟用:
#swapoff /dev/paging00
該命令可能由於I/O錯誤或者沒有足夠的交換空間容納paging00上的交換頁面而失敗。
可以使用如下命令動態修改一個交換空間的大小:
#chps –d 1 paging00 #從交換空間paging00中刪除1個LP;
#chps –s 1 paging00 #給交換空間paging00中增加1個LP;
注意,該命令不能使主交換空間(通常是hd6)減小到32M以下。
如下命令可用來刪除一個交換空間:
#rmps paging00
刪除一個交換空間之前,該交換空間必須是非啟用狀態。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/196700/viewspace-722224/,如需轉載,請註明出處,否則將追究法律責任。

相關文章