Chinaunix首页 | 论坛 | 博客
  • 博客访问: 576543
  • 博文数量: 226
  • 博客积分: 10080
  • 博客等级: 上将
  • 技术积分: 1725
  • 用 户 组: 普通用户
  • 注册时间: 2007-11-26 11:15
文章分类

全部博文(226)

文章存档

2011年(5)

2010年(64)

2009年(99)

2008年(37)

2007年(21)

我的朋友

分类:

2008-10-28 20:52:00

交换空间,也即操作系统中的虚拟内存,本文简单介绍了一些交换空间管理的基本命令。


交换空间分配原则:

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"

如何创建交换空间,可以用smitmkps命令来完成,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是一个顺序号,例如0001等。

如果交换空间在创建时没有激活,可以使用如下命令激活:

#swapon /dev/paging00

Swap –a命令可以激活/etc/swapspaces中定义的所有交换空间,该命令一般在系统启动时自动执行。

如下命令可以使一个已经激活的交换空间变为非激活:

#swapoff /dev/paging00

该命令可能由于I/O错误或者没有足够的交换空间容纳paging00上的交换页面而失败。

可以使用如下命令动态修改一个交换空间的大小:

#chps –d 1 paging00 #从交换空间paging00中删除1LP

#chps –s 1 paging00 #给交换空间paging00中增加1LP

注意,该命令不能使主交换空间(通常是hd6)减小到32M以下。

如下命令可用来删除一个交换空间:

#rmps paging00

删除一个交换空间之前,该交换空间必须是非激活状态。

阅读(814) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~