AIX - 1

来源:互联网 发布:台湾电视剧星星知我心 编辑:程序博客网 时间:2024/04/29 11:00

第 1 讲:AIX系统日常管理

 

1. 文件系统是否满

方法: df –k 可以以K为单位检查文件系统的使用率。(90%以上,需要调整)

2. 检查系统出错日志 使用errpt |more来检查

清除现有的log: Errclear 0

3. 检查系统合法/非法登陆情况

使用Last命令来检查来自登陆的地方。

4. 检查系统是否有巨大的Core文件生成

使用 find / -name core –print来检查。对Core文件,一般直接删除就可以了。

5. 系统性能检查:

a) CPU性能:使用Vmstat, topas来检查

b) 内存使用情况:也是使用topas, vmstat来检查

c) 检查IO平衡使用情况:使用iostat来检查

d) 交换空间使用情况:使用lsps –a来检查

6. Mail检查

7. Diag 一个月一次

 

第 2 讲:AIX的版本号代表什么意思?

 

AIX的版本号的格式通常为AIX x.x.x.x.例如: AIX 4.3.3.1.其代表意义分别为:

操作系统版本号(version).发行版号(release).改进版号(modification).修正版号(fix)

 

第 3 讲:AIX资源监控与调制工具

 

本文出自:http://www.ccw.com.cn/ 作者: 陆成新 (2002-04-15 06:02:01)

性能优化以及确定系统中的性能瓶颈是系统管理员的主要任务之一。在一个计算机系统中,CPU、内存、硬盘和网络是影响系统性能的主要因素,因此系统性能调整也主要在于如何在这些资源中获得某种平衡,以满足人们对系统性能的期望。性能调制需要很多技巧,知识以及经验,不能仅靠分析统计数字,图表就可取得,性能调制有时是一件复杂甚至是非常困难的任务。

如同其它UNIX系统一样,AIX也给系统管理员剪裁系统提供了非常丰富的手段。这里我们简单介绍RS/6000 AIX系统中几个用于监控和调制多项系统资源的工具,每个工具的功能都很强,如想更透彻地了解这些命令的用法,请参考有关技术资料或手册。这里讲述的命令将不仅仅局限于CPU、硬盘、内存或网络资源的某个方面,它们可用于其中的一项或多项资源。

AIX监控工具

1、iostat

iostat命令主要通过观察物理磁盘的活跃时间以及他们的平均传输速度,监控系统输入/输出设备负载。根据iostat命令产生的报告,用户可确定一个系统配置是否平衡,并据此在物理磁盘与适配器之间更好地平衡输入/输出负载。

iostat工具的主要目的是通过监控磁盘的利用率(tm_act字段),而探测到系统中的I/O瓶颈。iostat还可用于确定CPU问题,辅助容量规划,并可以为最终解决I/O问题提供相关材料。vmstat和iostat联合使用,可捕获到确定与CPU,内存和I/O子系统有关的性能问题的必需数据。

iostat命令可产生下面四种类型的报告:

· tty和CPU利用情况

· 磁盘的利用情况

· 系统吞吐率

· 适配器吞吐率

2、netpmon

netpmon命令可以监控关于网络行为的系统事件和性能以及网络行为对CPU的消耗。netpmon命令在指定的监控周期报告网络行为。

netpmon启动后直至发布trcstop命令终止它之前,一直在后台运行。如果使用缺省设置,trace命令将会在netpmon命令之后立即自动启动。另外,netpmon中还可用trcon命令选择在后面的某个时间跟踪。当这种跟踪用trcstop命令终止后,netpmon命令就会输出它的报告并退出。缺省时报告会输出到标准输出,需要时也可以重定向到某个文件。

netpmon命令还可以在一次先前产生的跟踪中以脱机模式使用。在这样的情况下,需要用gennames命令产生一个文件。该文件必须在trace终止后立即产生。

所产生的报告中包括CPU使用情况、网络设备驱动器I/O情况、互联网络套接字调用,以及网络文件系统(NFS)I/O信息:

· CPU use:netpmon命令报告线程和中断处理器对CPU的使用情况。该命令将网络相关行为的CPU使用情况与其它行为的CPU使用情况区分开。

· Network Device Driver I/O:netpmon命令监控网络适配器上所通过的I/O统计。

· Internet Socket Calls:netpmon命令在互联网络套接字上监控read,recv,recvfrom,write,send以及sendto子程序。ICMP,TCP,UDP这几个协议的每个进程都会予以报告。

· NFS I/O:netpmon命令监控客户NFS文件上的read和write子程序,NFS客户上的RPC请求以及NFS服务器的read和write请求。

3、PDT(性能诊断工具)

PDT通过收集和集中各种性能、配置和可用数据自动找出性能问题。PDT评估系统的当前状态并跟踪系统在工作量和性能上的变化。PDT数据收集和报告很容易起用,不需要更多的管理行为。

虽然许多常见的系统性能问题都有特定性,但PDT还试图用一些被认为性能好的系统中的通用概念来帮助它查找问题。这些概念包括:

· 资源的平衡使用

· 在限定范围操作

· 确定的工作量趋势

· 无错误操作

· 系统参数得到适当设置。

4、ps

ps命令是UNIX系统中最常见的命令,它主要显示系统中关于进程的统计和状态信息,如进程ID,I/O行为以及CPU利用率等。利用ps命令提供的信息,可决定一个进程运行了多长时间,进程使用了多少CPU时间,以及进程是否受系统的惩罚。还可用ps命令确定进程使用了多少内存,完成多少I/O,进程的优先级以及是谁创建了进程。

下面这几个命令组合对于管理RS/6000 AIX系统有帮助:

(1)显示10个消耗CPU最多的进程:

# ps aux |head -1 ;ps aux |sort -rn +2 |head –10

(2)显示10个消耗存储空间最多的进程:

# ps aux |head -1 ;ps aux |sort -rn +3 |head -10

(3)按顺序显示系统中受罚的进程:

#ps -eakl |head -1 ;ps -eakl |sort -rn +5

(4)按优先级顺序显示系统中的进程:

#ps -eakl |sort -n +6 |head

(5)按处理时间为顺序显示系统中的前十个进程:

#ps vx |head -1 ;ps vx |grep -v PID |sort -rn +3 |head –10

(6)按实际内存使用的多少顺序显示系统中的前十个进程:

#ps vx |head -1 ;ps vx |grep -v PID |sort -rn +6 |head –10

(7)按换入页面的多少顺序显示系统中的前10个进程:

#ps vx |head -1 ;ps vx |grep -v PID |sort -rn +4 |head -10

5、vmstat

vmstat命令报告关于核心线程,虚拟内存,自陷(trap),磁盘以及CPU行为的统计。而且每种行为报告都被更细致地用百分比分别表示用户态、核态、空闲以及等待磁盘I/O等情况。

内核维持了对核心线程,换页以及中断行为的统计数据,而vmstat命令则通过使用knlist子程序和/dev/kmen伪设备驱动器访问这些数据。磁盘的输入/输出统计是通过设备驱动器维持的。对于磁盘,平均传输速度是通过使用活跃时间核传输信息数目决定的。而活跃时间百分比则是从报告期间驱动器忙的时间量计算出来的。

vmstat命令产生五种类型的报告:

· 虚存行为报告

· fork子进程情况报告

· 每个设备产生的中断情况报告

· 汇总报告

· 输入/输出行为报告

6、sar

sar命令报告CPU的使用情况,I/O以及其它系统行为。sar命令可以收集,报告以及保存系统行为信息。如果没有指定输入文件,则sar调用sarc命令访问系统数据。

用户可用让cron命令运行两个shell脚本(/usr/lib/sa/sa1和/usr/lib/sa2)以提供日统计和报表。在crontab文件/var/spool/cron/crontabs/adm中包括了一些样本节,用于示范cron要在何时运行这些shell脚本。以这种方式收集到的数据对于确定系统的时间周期特征和决定峰值使用时间是有用的。

但要注意的是,sar命令自己运行时会产生相当数量的读写。因此最好在没有工作量的情况下运行sar统计,看看sar对总的统计数字有多大的影响。

7、topas

topas命令用于监控各种系统资源,如CPU的使用情况,CPU事件和队列,内存和换页空间的使用,磁盘性能,网络性能以及NFS统计等。它还会报告指派给不同WLM类的进程对系统资源的消耗情况。它还能报告系统中最热门的进程和工作量管理器(WLM)的热门类。有关WLM类信息只有在WLM激活时才会显示。topas命令将热门进程定义为那些使用大量CPU时间的进程。topas命令没有作日志的选项,所有信息都是实时的。

topas命令利用System Performance Measurement Interface(SPMI)API获得有关信息。正是因为通过SPMI API,使系统开销保持在最小程度。topas命令使用perfstat库调用访问perfstat内核扩展。

8、truss

truss命令跟踪一个进程的系统调用、所接收的信号以及招致的机器错。要检查的应用程序可在truss命令的命令行中指定,也可将truss命令挂在一个或多个已经在运行的进程上。

AIX调制工具

1、fdpr

fdpr命令改进用户级程序和库的执行时间和对实际内存的使用。fdr命令可以通过不同的操作,如删除不必要的指令和重组代码和数据,而实现这样的目标。fdr命令安装在目录/usr/bin下。

fdpr命令在三个不同阶段上,对原有的执行代码应用先进的优化技术从而为其构筑一个优化的可执行代码。这三个阶段分别是:

· 在阶段1,fdpr创建一个增加了某些装置(instrumented)的可执行程序。原有的可执行程序被保存为__ProgramFile.save,而新版本被命名为__ProgramFile.instr。

· 在阶段2,fdpr运行该增加了某些装置的可执行程序,并收集摘要(profiling)数据。该摘要数据被保存在一个叫__ProgramFile.prof的文件中。运行执行程序时需要为它提供典型的输入数据,以使fdpr命令能够找出代码中可优化的部分。

· 在阶段3,fdpr命令使用阶段2中收集到的重要信息对可执行代码重新排序。这些重新排序涉及到这样一些任务:

(1)将那些高频度执行代码序列包装在一起。

(2)对条件分之重新排序,以改进硬件对分之条件的预测。

(3)将较少使用的代码部分移出来。

(4)内嵌一些热门函数。

(5)从重排序后的代码中删除掉NOP(空操作)指令。

另外,编译器中还提供了一个-qfdpr标志,用它可使编译器在执行代码中增加一些额外的信息,以辅助fdpr对该执行代码重新排序。但是,如果使用这个-qfdpr标志,则fdpr也只对那些用-qfdpr标志编译的模块重新排序。

2、schedtune

schedtune命令可以给抖动、进程挂起、时间片以及线程在锁上所能轮询的时间长度等设置准则。

用schedtune,可调整AIX中所设立的一组影响其内存负载控制机制的参数。Schedtune命令用于显示和修改那些用于检测系统内存是否在过度使用以致造成抖动的参数。Schedtune命令还能用于修改运行在系统上的进程的惩罚和衰减因子。在root用户下,用schedtune命令可做下面的事情:

· 决定用于确定抖动的准则。

· 决定哪个准则用于挂起进程。

· 决定在抖动终止后要等待多长时间才重新激活那些先前被挂起的进程。

· 决定被挂起的进程的最小数目。

· 调制调度优先级公式。

· 更改时间片数值。

· 决定在一把锁上轮询多长时间。

· 将schedtune值复位到它的缺省值。

需要注意的是,所有用schedtune作的修改在系统重启后都将丢失。为了确保所需的schedtune值在引导时能够置上,可在/etc/inittab文件中插入适当的schedtune命令。如:schedt:2:once:/usr/samples/kernel/schedtune -s 65536

3、vmtune

vmtune命令负责显示和调整虚存管理器(VMM)和其它AIX部件使用的参数。系统中的根用户可动态修改包括下面这些参数:

· VMM页替换

· 永久文件读写

· 文件系统缓冲区结构(bufstructs)

· LVM缓冲区

· 裸输入/输出

· 换页空间参数

· 页删除

· 内存固定参数

 

第 4 讲:AIX常用命令

 

查看交换区信息:

lsps -a 显示交换区的分布信息

lsps -s 显示交换区的使用信息

slibclean 清除处理程序遗留的旧分页信息

smit mkps 建立交换区空间信息

swapon -a 启动所有的分页空间

/etc/swapspaces 存放分页空间表格信息

-------------------------------------------------

显示卷信息:

lsvg 显示卷的名称

lsvg -l rootvg 显示rootvg卷的详细信息

 

-------------------------------------------------

mount卷的方法:

varyonvg datavg 加载datavg卷

mount /dev/data1 加载datavg下的一个data1卷

 

裸设备类型:raw,jfs jfs可以转变成文件系统,而raw则不行

-------------------------------------------------

 

在裸设备上安装oracle系统:

修改裸设备的权限,如裸设备名为system01,安装数据库用户为oracle

chown oracle:dba /dev/system01

chown oracle:dba /dev/rsystem01

在使用文件时必须用rsystem01

-------------------------------------------------

 

smit快速路径名称:(smit:图形方式,smitty:字符方式)

dev 设备管理

diag 诊断

jfs 定期档案管理系统

lvm 逻辑卷册系统管理员管理

nfs NFS管理

sinstallp 软件安装及维护

spooler 列印队列管理

system 系统管理

tcpip TCP/IP管理

USER 使用者管理

clstart,clstop:启动和停止cluster

lssrc -g cluser:查看cluser的状态

-------------------------------------------------

查看已安装的软件信息:

ls -aF /usr/lpp (lpp:Licensed Program Products)

查看安装媒体内容:

installp -q -d /dev/cdrom -l

-------------------------------------------------

启动时自动加载文件系统信息:

需要加载的信息存放在/etc/filesystems

mount -t nf 加载所有在/ect/filesystems中定义type=nfs的文件系统

显示已加载的文件系统及状态: df -v,mount

-------------------------------------------------

查看错误日志信息:

errpt -a

-------------------------------------------------

有关TCP/IP的命令

网路卡:

smit chgenet,chgtok,chgfddi,opschange,mktty:adptr架构快速路径

smit mkinet,ppp:slip与ppp快速路径

ifconfig:config界面

位址:

/etc/hosts 静态主机表

/etc/resolv.conf 位址解析的名称服务器

/etc/named.boot 名称服务器架构

/etc/named.ca 根名称服务器快取

/etc/named.data 位址列表

/etc/named.rev 反转指标列表

nslookup 查询名称服务器资讯

网络路由:

route 管理路由

netstat -rn 列出定义的路由

routed 路由(daekmin rip)

gated 路由(daekmin rip、egp、hello)

/etc/gateways 已知网关

/etc/networks 已知网路

服务:

/etc/services

/etc/inetd.conf

TCP/IP群组子系统:

/etc/rc.net

startsrc -g tcpip 启动全部的tcpip子系统

startsrc -s inetd 启动主要internet

除错:

iptrace 启动封包追踪

ipreport 追踪结果格式化输出

netstat 网络统计

ping 检查是否可以到达

查看HACMP,外部硬盘信息:

lscfg -v

lsdev -Cc adapter

对等机器信息:

/etc/.rhosts

/etc/hosts.equiv

/etc/hosts

-------------------------------------------------

 

观察进程内存使用情况:

ps aux 观察参数%mem:内存使用百分比 RSS:实际使用内存

vmstat free的单位为块,缺省值为4096bytst

-------------------------------------------------

 

创建raw设备时选择的类型:

raw_lv

 

第 5 讲:常用AIX论坛地址、资料下载地址、FTP地址

 

AIX论坛:

 

http://www.loveunix.net/ ; 《爱U家园》是大家的快乐空间

http://www.passcisco.com/bbs/list.asp?boardid=29 ; AIX使用者论坛

http://www.chinaunix.net/cgi-bin/bbs/forums.cgi?forum=5 ; chinaunix的AIX论坛

http://www.aixchina.com/ ; AIX中国论坛

http://www.swg.com.cn/bbs/cgi-bin/leoboard.cgi ; 思达奇公司的AIX 技术区

http://www.itpub.net/forumdisplay.php?s=&forumid=29 ; itpub的UNIX论坛

http://www.ibmusers.com/ ; 银信公司网站

http://bbs.interconn.com.cn/cgi-bin/forums.cgi?forum=2

 

第 6 讲:AIX操作系统使用心得

 

 

AIX是IBM公司开发的业界领先的优秀商务Unix操作系统,在可靠性、可用性、开放性、扩展性、高性能、安全性等方面都非常突出,尤其是在Internet的关键应用领域以及系统和硬件管理能力方面,其性能表现更为出色,受到了业界的普遍认可和广泛使用。以下是笔者几年来使用AIX系统的一点心得,兹供使用该系统的其他读者参考。

 

1.如何禁止终端上的中断键(CTRL+C)?

在很多应用系统中,系统管理员希望普通用户只运行自己的应用程序,不能进入系统的shell提示符下,但缺省情况下当用户在终端上按CTRL+C键时就会退到系统提示符下。由于用户终端一般没有固定的端口号,为了禁止使用中断键,可采取下面办法:

(1)如果使用ksh, 可在$HOME/.profile中第一行加入如下内容:

trap "echo 'Abnormal operation'; exit" 123915

(2)如果使用csh(ksh亦可),可用如下命令:

%stty intr ^!

如果恢复正常情况,键入下列命令:

% stty intr ^c

 

2.如何在shell中不回显(echo)字符?

在实际应用中,一般当我们在键盘上键入口令时不希望将其显示在屏幕上,为此可采用下面的两种办法:

·使用stty 命令

stty -echo # do not display password

echo "Enter password: \c"

read PASSWD #get the password

stty echo # restore standard configuration

·使用echo命令

设置保密属性:echo "\033[8m"

取消保密属性:echo "\033[m"

 

3.如何在某个目录及其所属子目录的所有文件中查找字符串?

在程序维护过程中,有时需要在某个目录及其所属子目录的所有文件中查找某一个字符串,为此可用下面两种方法(假设在*.cp文件中查找字符串"abc",结果放在文件out中):

(1)cat /dev/null > out

find ./ -name "*.cp" -exec grep "abc"{} >> out

(2)find ./ -name "*.cp" | xargs grep "abc" > out

推荐使用第二种方法,因其系统开销小、速度快。

 

4.如何对/etc/inittab文件中的一行进行注释?

我们都知道在shell中使用"#"作为注释符号,但在/etc/inittab中注释一行的方法是在第一个字符前插入字符":"。

 

5.如何转换DOS和AIX两种格式的文本文件?

如欲转换DOS和AIX两种格式的文本文件,有两种方法:

(1)用ftp命令:设置ASCII传输类型,在一台运行AIX的机器和另外一台运行Windows的机器之间互相传送,这里不再赘述。

(2)使用AIX2dos或dos2AIX命令

如将DOS格式的文本文件转换为AIX格式,可用命令A:dos2AIX inputfile outfile,反之可用命令:AIX2dos inputfile outfile,关于dos2AIX和AIX2dos命令的详细用法可参阅"dos2AIX -h "和"AIX2dos -h "。注意要使用这两个命令,必须首先安装文件集bos.pci。

 

6.如何解决某一PV上的VGDA与ODM库不一致的问题?

在系统维护过程中,因为操作错误或其他特殊原因,有可能使某一PV上的LVCB和VGDA与其对应的ODM库不一致,导致ODM库紊乱,对PV的有关操作无法进行,这时可采用如下两个AIX命令加以解决:

redefinevg -d hdisk_name vg_name

该命令以指定PV上的LVM信息重新定义给定VG的ODM库。

或:synclvodm -P -v vgname

该命令同步或重建给定VG的ODM库和LVM信息。

 

7.如何设置用户的文件大小限制?

在AIX系统中,用户使用系统资源是有一定限制的。如用户缺省可创建或扩展的最大文件为1G(参见/etc/security/limits: fsize = 2097151, fsize_hard=fsize 512-bytes blocks)。

如欲修改,可使用smit:

# smit chuser 选择用户,修改下面两项:

Soft FILE size [4194302]

# (2G,可根据需要设定)

Hard FILE size [4194302]

# (2G, 可根据需要设定)

用该用户身份登录,使用"ulimit -f "和"ulimit -Hf"可分别显示其fsize、fsize_hard的大小。

 

8、如何按文件大小排序列出一个文件系统下的文件?

当监控某一文件系统的空间使用情况时,如果该文件系统剩余空间较少或已使用空间增长较快,则有必要排序列出该文件系统中所有大于某一给定字节数的文件,以便进一步维护管理。为此,可用如下命令:

# find [filesystem_name] -xdev -size +[512-bytes bloks] -ls | sort -r -n -k7

 

以上所有命令在AIX4.3.3下全部测试通过。

 

第 7 讲:AIX环境如何找到活动最频繁的进程

 

1。下面命令输出中的'C'字段是一个进程的cpu-penalty值(0到120之间),值越大表明进程越活跃。

 

# ps alxw | sort +5 -n

 

2.显示前10个累计占用CPU时间的进程

#ps -e|head -n 1;ps -e|grep -v"TIME|0:"|sort +2b -3 -n -r|head -n 10

3。显示前10个当前占用CPU时间的进程

#ps -ef|head -n 1;ps -ef|grep -v"C|0:00"|sort +3b -4 -n -r|head -n 10

4。显示前10个占用CPU应用的进程

#ps gu|head -n 1;ps gu|grep -v"CPU|kproc"|sort +2b -3 -n -r|head -n 10

 

第 8 讲:AIX中查看用户对系统资源的使用情况

 

 

在AIX中可以通过打开acct功能来查看用户的资源使用情况,主要包括:用户连接情况、用户CPU使用情况、

磁盘使用情况和打印机使用情况等。具体的步骤(共7步)有:

1. 在/var/adm/acct目录下创建三个子目录:nite,sum,fiscal

2. 以root登录,到/var/adm目录下,执行/usr/lib/acct/nulladm wtmp pacct。

3. 通过在/etc/rc文件中添加两行(最后一行"exit 0"之上):

echo "Starting Process Accounting"

/usr/bin/su - adm -c /usr/lib/acct/startup

打开记帐功能。

4. 将/etc/filesystems中要加入磁盘记帐的文件系统相关节中的account值改成true

5. 修改/etc/qconfig文件,要加入打印机使用记帐的打印队列的描述节中添加一行,如:

lp0:

device=dlp0

acctfile = /var/adm/qacct # 添加行

6. 修改cron,例/var/spool/cron/crontabs/adm文件:

10 23 * * 0-6 /usr/lib/acct/runacct 2> /usr/adm/acct/nite/accterr > /dev/null

0 23 * * 0-6 /usr/lib/acct/dodisk > /dev/null 2>&1

0 * * * * /usr/lib/acct/ckpacct > /dev/null 2>&1

15 4 1 * * /usr/lib/acct/monacct > /dev/null 2>&1

7. 如果要使用adm用户进行记帐管理,首先要给它分配密码,然后在PATH环境变量中包括/usr/lib/acct以方便命令执行。

完成这些步骤后,系统会在步骤一生成的目录下定期生成报告文件,记录各用户的资源使用情况。

 

第 9 讲:AIX的系统备份和恢复

 

备份和恢复是系统管理员经常要做的事情, 主要包括rootvg备份和用户数据备份.

  1. 操作系统和系统程序的备份:

  将一盘新磁带或无用磁带插入磁带机

  #tctl -f /dev/rmt0 rewind

  #smit mksysb

  

 

  在"备份设备或文件"中添入"/dev/rmt0"后回车.

  系统会运行很长时间, 等到屏幕显示OK后拿出磁带. 这时候, 系统备份完成. 注意:

mksysb仅备份rootvg中已安装的文件系统.

 

  2. 用户数据备份

  · 常用磁带机选项

  /dev/rmt0: 若选择/dev/rmt0, 在插入磁带和写完一次磁带时, 磁带机都将磁带反绕到头.

因此, 下一次备份文件将覆盖本次备份.

  /dev/rmt0.1: 若选择/dev/rmt0.1, 则插入磁带和写完一次磁带时, 磁带机均不反绕磁带.

因此, 一盘磁带可以连续备份几个文件或文件系统.

  · #smit fs

  选择"备份文件系统"

 

  添入要备份的"文件系统名称"

  添入"/dev/rmt0.1"

  

 

  重复上述操作即可在同一盘磁带上备份多个文件系统.

 

  3. rootvg的恢复

  · 启动机器进入维护模式

  参见安装手册, 当出现"Welcome to Base Operating System Installation and Maintanence"时,

选3 "Start Maintenance Mode for System Recovery"

  

  · 恢复系统

  继续选4 "Install from a System Backup"

  出现"Choose mksysb Device"画面, 选"/dev/rmt0"并插入磁带后回车.这时候, 系统自动恢复操作系统.

 

  4. 用户数据恢复

  #tctl -f /dev/rmt0 rewind

  #smit fs

  选择"恢复文件系统"

  添入"设备名称"和"目标目录"

  

  系统会自动找到相应目录恢复.

 

第 10 讲:AIX如何自动启动和关闭软件的运行?

 

本文档讨论了如何定制系统, 以使用户定义的应用在系统引导过程中自动启动, 并在系统关闭时自动停止.

 

1. 自动启动定制的软件

在系统引导时, init进程顺序检测/etc/inittab文件, 决定在引导过程中进行什么样的操作.如果应用, 进程或其它的用户操作需要在系统引导过程中进行, 则要在/etc/inittab文件中加入相应的条目.通常的做法是创建一个名为rc.local的脚本文件, 将所有要在系统引导过程中启动的用户应用写入该脚本文件中. 该脚本文件可以在/etc/inittab文件中被调用, 通常是在所有系统应用和服务启动后, 在用户登录被允许之前被调用. 位置通常是在主控登录的条目前.

下面是一个例子:

rc.local:2:wait:/etc/rc.local > /dev/console 2>&1

在上面的条目中, init将在执行余下的条目之前等待该脚本程序的完成.如果进程, 应用或命令需要通过特定的用户运行, 则可在运行的命令中加入su命令.

如: su myuser "-c /usr/bin/myapp"

建议在脚本程序中加入应用开始启动和完成启动的输出提示.

如:

#!/bin/ksh

echo "Starting User Applications...."

echo "Starting Application XYZ"

su myuser "-c /usr/bin/myapp"

echo "Startup of User Applications completed"

2. 自动停止定制的软件

shutdown命令用于关闭AIX系统. 在此操作中会关闭所有AIX子系统及文件系统.如果名为/etc/rc.shutdown的脚本程序存在, 系统会首先执行该脚本程序中的命令. 在该脚本程序中可以加入关闭用户应用的命令. 建议在脚本程序中加入应用停止运行和完成停止运行的输出提示.

如:

#!/bin/ksh

echo "Stopping User Applications...."

echo "Stopping Application XYZ"

[ commands to stop application ]

echo "Shutdown of User Applications completed"

 

第 11 讲:如何查看操作系统中是否安装了某个补丁程序?

 

使用命令:

lslpp -Bl Uxxxxxx

Uxxxxxx 是补丁程序的ID.

例: lslpp -Bl U465241 命令可用于查看系统中是否安装了ID为U4652241的补丁程序.

 

第 12 讲:如何检查AIX文件系统的病毒?

 

#virscan directory

例如: virscan /usr

 

第 13 讲:AIX如何解决"device busy"问题

 

 

当我们对网络或网卡进行操作时,经常会遇到"device busy", 而不让我们进行操作.

 

例如:

 

rmdev -l ent1

Method error (/etc/methods/ucfgdevice):

0514-062 Cannot perform the requested function because the

specified device is busy.

 

1.首先我们要确认网络接口已经"down"及 "detached".

使用以下脚本文件可以"down"及"detach"所有TCP/IP网络接口.

 

interfaces=`lsdev -Cc if -F name | grep -v lo0`

for interface in $interfaces

do

ifconfig $interface down

ifconfig $interface detach

done

 

2. 检查是否下列应用正在运行:

 

1) SNA : lssrc -g sna (检查SNA是否运行)

stopsrc -g sna(中断)

stopsrc -f -s sna(强行中断)

如果以上两条命令都不起作用: /usr/bin/sna -stop sna -t forced

如果仍不能中断: /usr/bin/sna -stop sna -t cancel

 

2)IPX: ps -ef |grep npsd

ps -ef |grep sapd (IPX是否运行)

/usr/lpp/netware/bin/stopnps (中断)

 

3)Netbios:ps -ef | grep netbios (是否运行)

mcs0 unload (中断)

 

 

以上步骤对于大部分"device busy"问题都可解决.

 

第 14 讲:何为AIX 5L?

 

 

AIX 5L 是AIX的下一代产品(当前为AIX V4),它支持IBM POWER 和Intel 64位(IA-64)平台.“L” 指Linux affinity.

 

第 15 讲:使用命令行安装删除文件包

 

在AIX 中, 一般使用"smit"命令来安装和删除文件包,但有时经常会遇到"smit"本身被破坏的情况, 我们可以使用"installp"命令来安装及删除文件包.

安装: installp -ac -Q -d /dev/cd0

删除: installp -u

 

 

 

第 16 讲:何为AIX/Montery

 

 

AIX/Monterey是IBM下一发展阶段的UNIX操作系统,其中AIX核心为Intel系统带来了极易扩展、高度可用、具有业界非凡实力的UNIX操作系统所具有的全部优势。AIX/Monterey是一项主要的UNIX操作系统方案的成果,该项方案由IBM领导,并与SCO和Intel合作,获得了业界领先的软件和系统厂商的广泛支持。AIX/Monterey是一个大规模的企业级UNIX操作系统,目前运行于各种Intel 32位体系架构(IA-32)及POWER体系架构之上。该产品将于今年晚些时候扩展到IA-64这一Intel的64位体系架构。AIX/Monterey所支持的系统十分广泛,包括从部门级服务器到大型数据中心服务器。AIX/Monterey融合了多种操作系统的最佳特性,包括AIX系统、IBM的DYNIX/ptx,以及SCO的UnixWare,其中DYNIX/ptx来自Sequent,运行NUMA-Q,而UnixWare则是当今运行于Intel平台上的最大份额的一种UNIX操作系统。今年晚些时候,对于那些偏爱基于Intel64位Itanium3系统的客户而言,IBM将为其提供AIX/Monterey/64,使其拥有与运行于RS/6000上的AIX同样强大的功能。AIX/Monterey则将继续满足客户对跨越各种基于Intel和POWER的系统、行业性强的企业级UNIX平台的需求。我们将在AIX/Monterey中构建强大的Linux兼容性,以帮助使Linux应用在AIX/Monterey上得以轻松实现,并帮助推动AIX/Monterey应用运行于未来版本的Linux之中。应用的可移植性有望比Linux的成熟提前实现,这将为客户的顺利过渡提供坚实的基础。另外,我们还将与开放源码团体共同合作,将AIX/Monterey技术应用于Linux之中,以便帮助建立起一种更好的Linux系统。

 

IBM完全能够帮助客户适应Linux的发展,其所具备的出众能力是其它任何UNIX厂商都无法企及的。对于运行于AIX/Monterey这一功能强大的全新操作系统之上的应用而言,IBM计划使其在未来能够轻松地移植到Linux中,并帮助客户保护其在硬件、应用、数据、过程和技术等方面的投资,因此,现今投资AIX/Monterey的客户可以充满自信地应对Linux的不断发展。

 

第 17 讲:如何查找系统中的某个文件存在于哪个文件集中?

 

 

当操作系统上由于未安装特定的文件集而无法执行某个命令时, 可以参考下面的方法确定所需的文件集.

首先确认系统中已安装了文件集 bos.content_list:

# lslpp -l bos.content_list

然后用下面的命令查找与指定文件相关的文件集:

# /usr/sbin/which_fileset

如, # /usr/sbin/which_fileset iostat

/usr/bin/iostat bos.acct

 

查找指定的文件集中包含哪些文件:

# lslpp -f

如, # lslpp -f bos.acct

 ....

 /usr/bin/iostat

 ....

第 18 讲:如何减小 /var/adm/wtmp 文件的大小?

 

 

文件 /var/adm/wtmp 的大小会在每次用户登录时增长, 但从不自动减小. wtmp 文件的内容会被命令 last 使用, 用于显示登录系统和重启机器的情况.该文件不能被删除, 但它的内容可用如下命令清除:

# > /var/adm/wtmp

 

第 19 讲:AIX使用异步I/O(aio)提高系统性能

 

 

如果是同步I/O,当一个I/O操作执行时,应用程序必须等待,直到此I/O执行完.

相反,异步I/O操作在后台运行,I/O操作和应用程序可以同时运行,提高了系统性能.

使用异步I/O会提高I/O流量,如果应用是对裸设备进行操作,这种优势更加明显.

因此象数据库,文件服务器等应用往往会利用异步I/O,使得多个I/O操作同时执行.

 

1. 如何知道是否需要异步I/O?

* 执行命令:"vmstat # #" 如果"wa"值超过25%.

* 执行命令:"iostat # #" 如果"%tm_act"值超过35%.

2. 查询有几个AIO服务器: pstat -a | grep aios | wc -l

3. 应该设几个AIO服务器?

一般为硬盘数的10倍,但不要超过80.

4. AIO驱动程序: bos.rte.aio

5. 配置AIO为可用: # smit chgaio ->

 STATE to be configured at system restart [available]

 

第 20 讲:AIX如何管理Paging Space

 

 

Paging Space 的大小应符合应用的需要.太大会浪费硬盘空间,太小会影响系统的运行.Paging Space的确定原则: 1. 系统实际内存小于64MB, paging space= 2 * RAM

2. 系统实际内存在 64MB to 256MB 之间, Page Space = RAM size + 16MB

3. 系统实际内存大于 256MB , Page Space = 512 + ( RAM - 256 ) * 1.25

4. 对于AIX 4.3.3 当内存达到4GB 到8GB,因为AIX 4.3.3 使用延迟的(deferred )paging space.Paging Space主要根据应用的要求来定.

一般可初始3GB, 然后观察paging space的使用情况,如果使用率超过70%, 则需要增加paging space.

以上计算方法只是粗略地算法,用户可根据实际情况调整.

 

* 如果系统出现以下几种情况,则说明需要扩大paging Space: 1. 下列任意错误信息之一:

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 many processes

Fork failure - not enough memory available

Fork function not allowed. Not enough memory available.

Cannot fork: Not enough space

2. 使用命令" lsps -a" ,其结果%USED 列的平均值大于80%.

3. 使用命令"lsps -s" 其结果%USED 列大于80%.

 

 

* 使用下列命令也可以检查paging space是否够用:

iostat

vmstat

lsps

 

第 21 讲:如何在AIX 4.3中安装联机手册?

 

使用联机手册之前,需安装相应的软件包。

解答 AIX 4.3 安装介质包含两张联机文档光盘(Documentation CD): Base Documentation CD 和 Extended Documentation CD。使用命令man查看系统命令之前

需要按照下列步骤安装相应的软件包: 1. 正确设置环境变量LANG的值,如“en_US”为英文环境,“zh_CN”为简体中文环境。可以用命令

export LANG=en_US

设置。

2. 使用man查看系统命令之前必须安装下列软件包:

 

bos.html.en_US.topnav.navigate - Top Level Navigation

 

bos.html.en_US.nav - Online Navigation

bos.html.en_US.cmds.cmds1 - AIX Commands Reference 1

bos.html.en_US.cmds.cmds2 - AIX Commands Reference 2

bos.html.en_US.cmds.cmds3- AIX Commands Reference 3

bos.html.en_US.cmds.cmds4- AIX Commands Reference 4

bos.html.en_US.cmds.cmds5 - AIX Commands Reference 5

bos.html.en_US.cmds.cmds6 - AIX Commands Reference 6

 

使用命令

 

lslpp -l

 

检查上述软件包是否已经安装。

 

3. 如果需要查询AIX 系统调用及C语言库函数,则要安装软件包 bos.html.en_US.techref.base - AIX Base Tech Ref

bos.html.en_US.techref.commo - AIX Commo Tech Ref

4. Documentation CD中还包含许多其它的手册,可根据需要安装相应的软件包。

 

在AIX系统中安装软件包可使用smit管理菜单。在命令行输入

 

smit install_all

 

选择:

 

1. CD-ROM 设备(通常为/dev/cd0)。

2. 将光标移至"SOFTWARE to install" 并按下或“+7”。

3. 将光标移至要安装的软件包并按下 或 “+7”选择要安装的软件包。

4. 选中所有要安装的软件包后按?lt;Enter> 开始安装,之后需再次按下确认后继续安装,直至成功。

此时就可以使用man查看系统命令了!

 

第 22 讲:如何在AIX中设置中文环境

 

 

环境

平台:RS/6000

软件版本: AIX 4.2 或更新版本

 

在AIX中使用中文有两种途径:第一是在安装AIX时选择中文语言,装好的系统自动显示中文(这种方法不推荐使用,它没有第二种方法使用起来灵活)。第二是安装AIX时选择英文,系统启动后手工设置中文环境,方法如下:

 

1. 将AIX系统盘的第一张光盘放入光驱;

2. 运行命令:

smitty

--> System Environments

--> Manage Languange Environment

--> Change/Show Primary Language Environment

--> Change/Show Cultural Convention, Language, or Keyboard

 

在随后显示的菜单中将光标分别移到以下字段:

 

Primary CULTURAL Convention

Primary LANGUAGE translation

Primary KEYBOARD

 

按下,从弹出的菜单中选择“IBM-eucCN”将上述字段改为简体中文,按下回车键后系统自动从光盘安装中文环境软件包。此操作完成后重新启动系统,操作界面即为简体中文。

 

需要输入中文时使用下列功能键切换输入方法:

 

AIX 4.3.3 以前的版本:+ F1 ---+ F4 切换到各种中文输入方法;

右 --- 切换到英文输入;

 

 

AIX 4.3.3: CTRL + [F2] : 智能 ABC ;

CTRL + [F4] : 拼音输入;

CTRL + [F5] : 五笔输入;

CTRL + [F6] : 郑码输入 ;

CTRL + [F7] : 表形码输入;

CTRL + [F9] : 内码输入;

CTRL + [F10] :英文半角;

 

此外,AIX还包含另外两种中文环境,即“UTF8”和“GBK”,它们与“IBM-eucCN”之区别在于包含了繁体汉字的使用。上述三种中文环境的设置方法均相同。

 

 

 

 

 

第 23 讲:AIX 的许可权限---ACL

 

 

ACL是对标准权限位的扩展。通过修改分配给个人或组的标准权限,对每个文件或目录进行更精细的控制。对每个组或用户,有3种权限分配情况:

PERMIT : 准许对文件或目录的特定权限。

DEMY : 限制对文件或目录的特定权限。

SPECIFY : 明确地定义文件或目录权限。

 

"acledit "命令用于建立ACL。首先必须设置文本编辑器.如:export EDITOR=/usr/bin/vi。

然后使用:acledit file_name

屏幕上将会显示:

attributes:

base permissions

owner (rcunning): rwx

group (staff): r—

others: ---

extended permissions

disabled

要设置扩展的权限,将“disabled ”设置改为“enabled”:

extend permissions

enabled

使用permit、deny 或specify关键字来定义扩展权限。前面的例子表明只有所有者能对这个文件写操作。组成员能读此文件而其他用户则没有任何许可权限。如果要使用户" joe"能够读写这个文件,用以下命令:

extended permissions

enabled

permit rw- u: joe.

要允许组用户joegroup读这个文件,用以下命令:

rermit r-- g: joegroup

 

你能够通过在同一行中合并多个条目来对权限进行微调。如果只想为pete提供读写权,而他是系统组的一部分,则用以下命令:

permit rw- u: pete, g: system

要为几个用户或组增加许可权限,则使用分行命令 :

permit rw- u: joe

permit rw- u: pete

 

使用" ls -el"命令,查看ACL是否已在文件中设置。如"ls -el profile"命令显示:

— rwxw--------+

最后的+表示文件已具 有有效的ACL 。

注意:使用有数字争议的chmod 命令将使文件或目录的ACL无效。

 

 

 

第 24 讲:AIX管理经验谈

 

在AIX中可以通过打开acct功能来查看用户的资源使用情况, 主要包括:

用户连接情况、用户CPU使用情况、磁盘使用情况和打印机使用情况等。

具体的步骤(共7步)有:

1. 在/var/adm/acct目录下创建三个子目录:nite,sum,fiscal

 

 

2. 以root登录,到/var/adm目录下,执行/usr/lib/acct/nulladm wtmp pacct。

 

3. 通过在/etc/rc文件中添加两行(最后一行"exit 0"之上):

echo "Starting Process Accounting" /usr/bin/su - adm -c /usr/lib/acct/startup

打开记帐功能。

 

 

4. 将/etc/filesystems中要加入磁盘记帐的文件系统相关节中的account值改成true

 

5. 修改/etc/qconfig文件,要加入打印机使用记帐的打印队列的描述节中添加一行,

如: lp0: device=dlp0 acctfile = /var/adm/qacct # 添加行

 

 

6. 修改cron,例/var/spool/cron/crontabs/adm文件:

10 23 * * 0-6 /usr/lib/acct/runacct \

2> /usr/adm/acct/nite/accterr > /dev/null

0 23 * * 0-6 /usr/lib/acct/dodisk > /dev/null 2>&1

0 * * * * /usr/lib/acct/ckpacct > /dev/null 2>&1

15 4 1 * * /usr/lib/acct/monacct > /dev/null 2>&1

 

 

7. 如果要使用adm用户进行记帐管理,首先要给它分配密码,

然后在PATH环境变量中包括/usr/lib/acct以方便命令执行。

 

 

完成这些步骤后,系统会在步骤一生成的目录下定期生成报告文件,

记录各用户的资源使用情况。

 

 

第 25 讲:AIX简介

 

 

AIX 全名为(Advanced Interactive Executive),它是IBM 公司的UNIX操作系统,

整个系统的设计从网络、主机硬件系统,到操作系统完全遵守开放系统的原则。

下面对AIX 作以介绍。

 

RS/6000 采用IBM 的UNIX操作系统-AIX作为其操作系统。这是一

个目前操作系统界最成功,应用领域最广,最开放的第二代的UNIX系

统。它特别适合于做关键数据处理(CRITICAL)。

 

AIX 包含了许多IBM 大型机传统受欢迎的特征,如系统完整性,系统可管理

性和系统可用性。

 

在 AIX操作系统上,有许多的数据库和开发工具,用户除了选用已有的应用

软件外,还可以根据各自的需要进行开发。

 

此外,在AIX 之上,有一组功能强,使用方便的系统管理工具。对于异种平台

互存,互操作有很成熟的解决方案。

 

由于该 UNIX 的先进的内核技术和最好的开放性,因此,虽然RS/6000

从宣布到今天只有短短的5 年多的时间,它已在各行各业有了广泛的运用,

并在1993和1994年连续二年在MIDRANGE商用 UNIX 领域处于第一位。

 

RISC SYSTEM/6000的操作系统是AIX ,它是性能卓越的、开放的

UNIX,汇集了多年来计算机界在UNIX上的研究成果,以IBM 在计算机

体系结构、操作系统方面40多年极其丰富的经验。最大限度的使用RISC

技术,安装了象AIX 这样的具备工业界实力的UNIX操作系统。

 

它既可连接SAA 体系结构,又能与非IBM 系统的网络相连,因此,可以

和多数专业银行现有的系统实现互连,这对今后业务系统拓展将带来极大的

灵活性,并降低投资。

 

AIX 遵循一系列的国际标准:

* IEEE POSIX1004.1-1990

* X/OPEN 移植指南ISSUE3的基本级(XPG3)

* AES/OS REVISION A (OSF/1 LEVEL 2 资格)

* FIPS 151-1

* AIX的编译器: XLC、C++(可选)、FORTRAN(可选)、PASCAL(可选)、COBOL(可选)

* ADA 的编译器已达到XPG3“成员”级的认可。

* AIX 支持多用户、多任务。

 

AIX有一些其它特性包括:

 

AIX 提供了3 种SHELL :SYSTEM V的KORN、BOURNE SHELL和4.3BSDC

SHELL作为可选择的UNIX系统界面;

 

安全设施满足TCB (Trusted Computing Base)的C2级;

 

实时处理能力,这对于“面向交易”的应用至关重要(如零售业

和银行等),它使RS/6000 获得极高的响应和吞吐量;

 

虚拟存储管理,当需要时,可将一些不常用的模块转送至外存,

提高内存的可利用性。

 

先进的文件系统,使得系统管理更加有效,并提高了数据可靠性

以及完整性。

 

能兼容DOS 应用程序和数据。

 

InfoExplorer,快速信息超文本索引系统- 不仅包括文字,而且

对包含声音、图像的索引系统,这是个联机的文件接口。包括全部的

超文本的索引和查找,以及面向任务和坐标的多重导引和索引系统。

这个文字及图形索引系统以一个灵活的、基于任务的方式去使用详细

资料及培训资料。

 

高级系统管理工具(SMIT,System Management Interface Tool)。

提供一级菜单驱动程序,诸如完成软件的安装与设置、设备的设置及

管理、问题的测定、存贮管理等。可以自动地进行I/O 设备设置,

ASCII 终端也可充当系统控制台。在LAN 上可以进行远程系统的安装。

 

 

 

第 26 讲:AIX网络诊断及解决现场实例

 

 

AIX网络诊断及解决现场实例

http://www.chinaunix.net/ 作者:viperonline发表于:2004-05-12 20:55:52

 

问题:有两台aix的测试机器,一台做应用,一台做数据库,都在同一个网段下(无双机),其中应用网络没有问题,而数据库这台网络有问题,内网下载只有30几K。

解决方法:对比法

由于这两台机器属于同一网段,机型完全一样,可以将两台机器的网络设置进行细致的对比,看看有何差异,然后改之。

 

使用netstat -v ent0 | grep -p "Specific Statistics"命令分别查看两台机器

应用:

netstat -v ent0 | grep -p "Specific Statistics"

10/100 Mbps Ethernet PCI Adapter II (1410ff01) Specific Statistics:

--------------------------------------------------------------------

Link Status: Up

Media Speed Selected: Auto negotiation

Media Speed Running: 100 Mbps Full Duplex

Receive Pool Buffer Size: 1024

Free Receive Pool Buffers: 1024

No Receive Pool Buffer Errors: 0

Receive Buffer Too Small Errors: 0

Entries to transmit timeout routine: 0

Transmit IPsec packets: 0

Transmit IPsec packets dropped: 0

Receive IPsec packets: 0

Receive IPsec packets dropped: 0

Inbound IPsec SA offload count: 0

Transmit Large Send packets: 0

Transmit Large Send packets dropped: 0

Packets with Transmit collisions:

1 collisions: 0 6 collisions: 011 collisions: 0

2 collisions: 0 7 collisions: 012 collisions: 0

3 collisions: 0 8 collisions: 013 collisions: 0

4 collisions: 0 9 collisions: 014 collisions: 0

5 collisions: 010 collisions: 015 collisions: 0

数据库:

netstat -v ent0 | grep -p "Specific Statistics"

10/100 Mbps Ethernet PCI Adapter II (1410ff01) Specific Statistics:

--------------------------------------------------------------------

Link Status: Up

Media Speed Selected: 100 Mbps Half Duplex

Media Speed Running: 100 Mbps Half Duplex

Receive Pool Buffer Size: 1024

Free Receive Pool Buffers: 1024

No Receive Pool Buffer Errors: 0

Receive Buffer Too Small Errors: 0

Entries to transmit timeout routine: 0

Transmit IPsec packets: 0

Transmit IPsec packets dropped: 0

Receive IPsec packets: 0

Receive IPsec packets dropped: 0

Inbound IPsec SA offload count: 0

Transmit Large Send packets: 0

Transmit Large Send packets dropped: 0

Packets with Transmit collisions:

1 collisions: 233543413 6 collisions: 011 collisions: 0

2 collisions: 0 7 collisions: 012 collisions: 0

3 collisions: 0 8 collisions: 013 collisions: 0

4 collisions: 0 9 collisions: 014 collisions: 0

5 collisions: 010 collisions: 015 collisions: 0

 

仔细对比发现数据库这台显然是双工模式与应用这台不同,应用的机器是自适应的,运行时是100M全双工模式,而数据库的机器限制为100M半双工模式,现在就是要将数据库这台改成与应用一样

更改双工模式的命令为smitty chgenet

但是在此之前要将需要更改的网卡down掉,以及所有经过此网卡的服务停止

步骤如下:

ifconfig -a

输出:

en0: flags=5e080863,80<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD,PSEG,CHAIN>

inet 10.100.10.6 netmask 0xffffff00 broadcast 10.100.10.255

再输入:

ifconfig en0 down

ifconfig en0 detach

smitty chgennt

输出:

[Entry Fields]

Ethernet Adapterent0

Description 10/100 Mbps Ethernet PCI Adapter II (1410ff01)

StatusAvailable

Location1L-08

Transmit descriptor queue size [512] +#

Receive descriptor queue size[512] +#

Software transmit queue size [8192]+#

Receive buffer pool size [1024]+#

Media Speed Auto_Negotiation +

IPsec Offload no +

Enable hardware transmit and receive checksum yes+

Enable TCP Large Send Offload no +

Enable Link Polling no +

Time interval for Link Polling [500] +#

Enable ALTERNATE ETHERNET address no +

ALTERNATE ETHERNET address [0x000000000000]+

Apply change to DATABASE only no +

更改之后需要重新设置默认网关(原来的会丢失)

smitty tcpip

Minimum Configuration & Startup

输出:

HOSTNAME [TEST1-CRM-APP-CLS]

* Internet ADDRESS (dotted decimal)[10.100.10.6]

Network MASK (dotted decimal)[255.255.255.0]

* Network INTERFACE en0

NAMESERVER

 Internet ADDRESS (dotted decimal) []

 DOMAIN Name []

Default Gateway

 Address (dotted decimal or symbolic name) [10.100.10.1]

 Cost[0]#

 Do Active Dead Gateway Detection?no +

Your CABLE Type N/A+

START TCP/IP daemons Nowno +

最后将网卡启用

ifconfig en0 up

问题得到解决!!!!

 

 

 

 

我的主页:http://tlcshxd.3322.org/index.html

 

第 27 讲:IBM巡检流程

 

 

1、检查系统硬件情况:设备故障灯是否有亮

2、系统错误报告(errlog)

3、有否发给root用户的错误报告(mail)

4、检查hacmp.out,smit.log,boot.log

5、关键系统的文件使用率不大于80%

6、逻辑卷有否stale

7、内存交换区使用率是否超过70%

8、内存交换区的大小是否为物理内存的1.5倍

9、检查备份情况(有否系统备份、用户数据备份、磁带机是否需要清洗)

10、通信(网卡、IP、路由表、ping、/etc/hosts、DNS设置等)

11、是否有数据保护方式如RAID10/RAID5,是否有Hot spare

12、系统DUMP设置是否正确

13、检查系统参数是否正确

1)/etc/enviroment中的TZ不能有夏时制

2)如有数据库:Aio:available

3)HACMP中I/O pacing:High Water Mark/Low Water MArk:33/24

4)HACMP中Syncd:10

5)HACMP中Power Monitorff

14、检查rootvg是否有镜象

15、检查errdemon,srcmstr是否正常运行

16、机房环境(电压、湿度)

17、系统性能:有否性能瓶颈(topas,vmstat)

18、补丁程序(PTF)、微码(是否需要升级)

19、HACMP测试:Cluster Verification

20、系统硬件诊断

21、运行#snap -ac,生成文件snap+s/n.pax.Z

22、机器清洁

 

注:1~15为A类维护(季度维护),16~18为B类维护(半年维护),19~22为C类维护(年度维护)

 

我的主页:http://tlcshxd.3322.org/index.html

 

第 28 讲:AIX Useful Commands

 

 

compress -c file.txt > file.Z Create a compressed file.

 

uuencode (infile) (extract-file-name) > (output file)

Converts a binary file to an ASCII file for transfer by modem or email

 

uudecode (encoded file)

Extracts a binary file from encoded file and calls it the extract-file-name

 

examples :-

 

uuencode maymap maymap > maymap.enc

uudecode maymap.enc

 

od -c /tmpDisplays contents of the /tmp directory file

ls -i Lists files with their inode numbers

echo *Lists files, can be used if ls is corrupt/missing

 

chtz (timezone eg GMT0BST)Changes the timezone in /etc/environment file

chlang (language eg En_GB)Changes the language in /etc/environment file

 

ar -v -t (archive file) List contents of an archive

ar -v -x (archive file) Extracts the archive

ar -v -t /usr/lib/libC-r.aLists contents of the libC_r.a library

 

find /source -print | cpio -pdm /target

Copying directories using cpio, creates /target/source directory.

 

dump -nTv (binary executable) Displays the contents of an executable file

 

dump -cDisplays string information

dump -oDisplays object file headers

dump -lDisplays line numbers

dump -sDisplays the text section

 

snap -ao /dev/rmt0 Create a snapshot onto tape

snap -ad (directory) Create a snapshot into a named directory other

 than the default (/tmp/ibmsupt)

 

/usr/dt/bin/dtconfig -dDisables desktop logins

/usr/dt/bin/dtconfig -eEnables desktop logins

/var/dt/Xpid PID of the dtlogin process

 

--------------------------------------------------------------------------------

LICENSES / SOFTWARE INSTALLATION

--------------------------------------------------------------------------------

 

 

lslicenseDisplays number of current user licenses

chlicense -u (number)Changes the number of user licenses

( ftp,rexec and rsh (without -i flag) do not need an AIX user license to be

able to access the system.

 

 

oslevel Returns operating system level

 

 4 . 3 . 3 . 0 <--------- Preventive Maintenance Level

 | | |

 | | +----------------Modification

 | +--------------------Release

 +------------------------Version

 

oslevel -l 4.3.3.0Displays all filesets that are "downlevel"

 

whence (program)Returns full path of program

whereis (program) Returms full path of program

 

what (program)Displays identifying info from the executable

like version number, when compiled.

 

lslpp -L alllist all installed software

lslpp -L (program set name) Check if software installed

lslpp -fLists filesets vs packages

lslpp -ha Lists installation history of filesets

lslpp -w /usr/bin/swaponLists the fileset that the file belongs to

 

lppchk -c Checks file checksums against SWVPD

lppchk -l Checks symbolic links against SWVPD

 

instfix -ik (fix number eg IX66617) Checks id fix is installed

instfix -ik 4330-02_AIX_ML

instfix -i | grep MLDisplays all ML's installed

 

instfix -k IX38794 -d /dev/cd0Installs a fix from cdrom

 

/usr/sbin/install_assistSmitty Installation Assistant

 

/usr/sys/inst.images/sys.bundlesSoftware bundle files

 

alt_disk_install -c hdisk1 Clones a running rootvg onto hdisk1

alt_disk_install -wWakes up alt vg

alt_disk_install -sSends alt vg to sleep !

alt_disk_install -xRemoves alt vg from disk

 

/usr/lpp/bosinst/blvset -d /dev/hdisk0 -p 4.2

Resets the pad string in the BLV to the correct AIX version. Needed if the

migration option is missing when installing.

 

installp -ad (device) (fileset) (level) Install apply and commit fileset

installp -pad (device) (fileset) (level)Preview install

installp -u (fileset) Remove fileset

installp -ld (device) List all software on device

 

example:-

 

installp -pad /dev/rmt0 X11.base 4.3.3.0

 

installp -CCleans up after a premature cancel or interrupted installation.

 

--------------------------------------------------------------------------------

 TERMINALS / DISPLAYS

--------------------------------------------------------------------------------

 

/usr/share/lib/terminfoDirectory with all support terminal info files.

 

ttyDisplays what the tty/pty number of the terminal is.

 

termdefreports the termtype setup in smit for the tty port

 that termdef is run on.

 

chdev -l (device eg tty1) -a term=vt100 Sets tty to a vt100 terminal type

 

penable tty0adds getty line into /etc/inittab for tty0 and starts getty

pdisable tty0 disables the getty line and disables getty

 

penable / pdisable -a option is for all

 

stty erase ^? Set backspace key for vt100 terminals

stty erase ^H Set backspace key for wyse50 terminals

 

lsconsDisplays the console device

chcons -a login=enable (device eg /dev/tty1)Changes the console device

 

lsdispDisplay adapter device information

chdispChange default display used by LFT subsystem

 

 

Create ttys on ports 0 to 7 on adapter sa2 :-

 

for i in 0 1 2 3 4 5 6 7

do

mkdev -c tty1 -t tty -s rs232 -p sa2 -w$i -a login=enable -a term=vt100

done

 

portmir -t /dev/tty0 Mirror current terminal onto /dev/tty0

portmir -o Turns off port mirroring

 

 

--------------------------------------------------------------------------------

NETWORK

--------------------------------------------------------------------------------

 

host (ip or hostname)Resolves a hostname / ip address

 

hostname Displays hostname

hostname (hostname)Sets the hostname until next reboot

 

lsdev -Cc if Lists all available/defined network interfaces

 

chdev -l (device name) -a hostname=(hostname)Changes hostname permanently

chdev -l inet0 -a hostname=thomas

 

ifconfig (device name)Displays network card settings

ifconfig (device name) up Turns on network card

chdev -l (device name) -a state=upTurns on network card

ifconfig (device name) down Turns off network card

ifconfig (device name) detach Removes the network card from the

network interface list

ifconfig en0 inet 194.35.52.1 netmask 255.255.255.0 up

 

ifconfig lo0 alias 195.60.60.1Create alias ip address for loopback

 

route (add/delete) (-net/-host) (destination) (gateway)

Adds or deletes routes to other networks or hosts, does not update

the ODM database and will be lost at reboot.

route add -net 194.60.89.0 194.60.90.4

 

chdev -l inet0 -a "net,-hopcount,1,-netmask,255.255.255.0,207.156.168.0,10.0.15.254"

(destination) ( gateway

Adds route and adds entry into ODM, route survives a reboot,

 

route -rnDisplay route table

odmget -q "attribute=route" CuAtDisplays routes in the ODM.

 

lsattr -EHl inet0Displays routes set in ODM and hostname

odmget -q "name=inet0" CuAtDisplays routes set in ODM and hostname

 

refresh -s inetd Refresh inetd after changes to inetd.conf

kill -1 (inetd PID)Refresh inetd after changes to inted.conf

 

netstat -i Displays interface statistics

entstat -d (ethernet adapter eg en0) Displays ethernet statistics

 

arp -a Displays ip to mac address table from arp cache

 

no -aDisplays network options use -o to set individual options or

 -d to set individual options to default.

 no -o option=value (this value is reset at reboot)

 no -o "ipforwarding=1"

 

traceroute (name or ipaddress)Displays all the hops from source to

destination supplied.

 

ping -R (hostname or ipaddress) Same as traceroute except repeats.

spray (hostname or ipaddress) Send a stream of packets to a host

 

stopsrc -g tcpipStops all running TCP/IP daemons

/etc/tcp.cleanStops all running TCP/IP daemons and removes all

lock files

/etc/rc.tcpip Start all TCP/IP daemons.

Do not use startsrc -g tcpip as this will start all

TCP/IP daemons including routed & gated

--------------------------------------------------------------------------------

N.F.S.

--------------------------------------------------------------------------------

 

exportfsLists all exported filesystems

 

exportfs -a Exports all fs's in /etc/exports file

 

exportfs -u (filesystem)Un-exports a filesystem

 

mknfs Configures and starts NFS services

 

rmnfs Stops and un-configures NFS services

 

mknfsexp -d /directoryCreates an NFS export directory

 

mknfsmntCreates an NFS mount directory

 

mount hostname:/filesystem /mount-pointMount an NFS filesystem

 

nfso -aDisplay NFS Options

nfso -o option=value Set an NFS Option

nfso -o nfs_use_reserved_port=1

 

 

我的主页:http://tlcshxd.3322.org/index.html

 

第 29 讲:BACKUPS

 

 

MKSYSB

------

 

mkszfile -f Creates /image.data file (4.x onwards)

mkszfile -X Creates /fs.size file(3.x)

 

mksysb -i (device of file)Creates a mksysb image

 

mksysb does not save any raw data and will not backup a filesystem that

is not mounted.

 

SAVEVG

------

 

savevg -if (device or file) (vg) Creates a savevg image

 

restvg -q -f (device or file)Restore from a savevg image

 Ensure that the restvg command is run from /

 

mkvgdata (vg)Creates new vgname.data file

 

CPIO ARCHIVE

------------

 

find (filesystem) -print | cpio -ocv > (filename or device)

 

eg find ./usr/ -print | cpio -ocv > /dev/rmt0

 

CPIO RESTORE

------------

 

cpio -ict < (filename or device) | moreLists archive

cpio -icdv < (filename or device)

cpio -icdv < (filename or device) ("files or directories to restore")

 

eg cpio -icdv < /dev/rmt0 "tcpip/*" Restore directory and contents

 cpio -icdv < /dev/rmt0 "*resolve.conf" Restore a named file

 

TAR ARCHIVE

-----------

 

tar -cvf (filename or device) ("files or directories to archive")

 

eg tar -cvf /dev/rmt0 "/usr/*"

 

TAR RESTORE

-----------

 

tar -tvf (filename or device)Lists archive

 

tar -xvf (filename or device)Restore all

tar -xvf (filename or device) ("files or directories to restore")

use -p option for restoring with orginal permissions

 

eg tar -xvf /dev/rmt0 "tcpip" Restore directory and contents

 tar -xvf /dev/rmt0 "tcpip/resolve.conf"Restore a named file

 

AIX ARCHIVE

-----------

 

find (filesystem) -print | backup -iqvf (filename or device)

Backup by filename.

 

eg find /usr/ -print | backup -iqvf /dev/rmt0

 

backup -(backup level 0 to 9) -f (filename or device) ("filesystem")

Backup by inode.

 

eg backup -0 -f /dev/rmt0 "/usr"-u option updates /etc/dumpdates file

 

AIX RESTORE

-----------

 

restore -qTvf (filename or device)Lists archive

 

restore -qvxf (filename or device)Restores all

restore -qvxf (filename or device) ("files or directories to restore")

(use -d for restore directories)

 

restore -qvxf /dev/rmt0.1 "./etc/passwd" Restore /etc/passwd file

 

restore -s4 -qTvf /dev/rmt0.1Lists contents of a mksysb tape

 

 

BACKUPS ACROSS A NETWORK

------------------------

 

To run the backup on a local machine (cpio) and backup on the remote

machine's (remhost) tape drive (/dev/rmt0)

 

find /data -print | cpio -ocv | dd obs=32k | rsh remhost \

"dd ibs=32k obs=64k of=/dev/rmt0"

 

To restore/read the backup (cpio) on the remote machine

 

dd ibs=64k if=/dev/rmt0 | cpio -icvt

 

To restore/read the backup (cpio) on the local machine from the remote

machine's (remhost) tape drive (/dev/rmt0)

 

rsh remhost "dd ibs=64k obs=32k if=/dev/rmt0" | dd ibs=32k \

| cpio -icvt

 

To run the backup (cpio) on a remote machine (remhost) and backup to

the local machines tape drive (/dev/rmt0)

 

rsh remhost "find /data -print | cpio -ocv | dd ibs=32k" \

| dd ibs=32k obs=64k of=/dev/rmt0

 

tar cBf - .| rsh remhost "dd ibs=512 obs=512 of=/dev/rmt0"

Same as above but using tar instead of cpio.

 

--------------------------------------------------------------------------------

Copying diskettes and tape

--------------------------------------------------------------------------------

 

COPYING DISKETTES

-----------------

 

dd if=/dev/fd0 of=(filename) bs=36b

dd if=(filename) of=/dev/fd0 bs=36b conv=sync or flcopy

 

 

COPYING TAPES

-------------

 

dd if=/dev/rmt0 of=(filename)

dd if=(filename) of=/dev/rmt0or tcopy

 

--------------------------------------------------------------------------------

VI Commands

--------------------------------------------------------------------------------

 

:g/xxx/s//yyy/ global change where xxx is to be changed by yyy

 

sed 's(ctrl v ctrl m)g//g' old.filename > new.filename

Strips out ^M characters from ascii files that have been transferred as binary.

To enter crontrol characters type ctrl v then ctrl ? where ? is whatever

ctrl character you need.

 

 

我的主页:http://tlcshxd.3322.org/index.html

 

第 30 讲:DEVICES

 

 

lscfglists all installed devices

lscfg -v lists all installed devices in detail

lscfg -vl (device name)lists device details

 

bootinfo -breports last device the system booted from

bootinfo -kreports keyswitch position

 1=secure, 2=service, 3=normal

 

bootinfo -rreports amount of memory (/ by 1024)

bootinfo -s (disk device)reports size of disk drive

bootinfo -Treports type of machine

 ie rspc,rs6ksmp,rspc or chrp

 

lsattr -El sys0 -a realmem reports amount of useable memory

 

mknod (device) c (major no) (minor no)Creates a /dev/ device file.

mknod /dev/null1 c 2 3

 

lsdev -Clists all customised devices ie installed

lsdev -Plists all pre-defined devices ie supported

lsdev -(C or P) -c (class) -t (type) -s (subtype)

 

chdev -l (device) -a (attribute)=(new value) Change a device attribute

chdev -l sys0 -a maxuproc=80

 

lsattr -EH -l (device) -D Lists the defaults in the pre-defined db

lsattr -EH -l sys0 -a modelname

 

rmdev -l (device) Change device state from available to defined

rmdev -l (device) -dDelete the device

rmdev -l (device) -SR S stops device, R unconfigures child devices

 

lsresource -l (device)Displays bus resource attributes of a device.

 

cfgmgrConfigures devices

cfgmgr -i /dev/cd0Configure devices and install drivers from /dev/cd0

if required

cfgmgr -S Run in serial, used with a larger number of disks

cfgmgr -l scsi0 Configure devices on adapter scsi0 only

 

diagRun hardware diagnostic menu

smitty diag Run hardware diagnostic menu

( 7020-40P and 7248-43P machines cannot run diagnostics, use diagnostics

in the SMS menus instead

 

diag -d (device)Run diagnostics against a device.

 

lsslotDisplays all hot swap slots

lsslot -c pci Lists all pci hot swap slots

lsslot -c pci -aLists all available pci hot swap slots

 

drslotReconfgiures PCI hot-plug slots

drslot -i -c pci -s U0.1-P1-I3Display a slot, flashes the LED next to

the slot so that it can be identified.

 

Power Management (PCI machines)

-------------------------------

 

pmctrl -aDisplays the Power Management state

 

rmdev -l pmc0Unconfigure Power Management

mkdev -l pmc0Configure Power Management

 

--------------------------------------------------------------------------------

TAPE DRIVES

--------------------------------------------------------------------------------

 

rmt0.x where x = A + B + C

 

A = density0 = high4 = low

B = retension0 = no2 = yes

C = rewind 0 = yes 1 = no

 

tctl -f (tape device) fsf (No)Skips forward (No) tape markers

tctl -f (tape device) bsf (No)Skips back (No) tape markers

tctl -f (tape device) rewindRewind the tape

tctl -f (tape device) offline Eject the tape

tctl -f (tape device) statusShow status of tape drive

 

chdev -l rmt0 -a block_size=512changes block size to 512 bytes

 (4mm = 1024, 8mm = variable but

1024 recommended)

dd if=/dev/rmt0 bs=128k count=1 | wc -c

Displays the block size of an unknow tape. Set block size to 0 first.

 

bootinfo -e answer of 1 = machine can boot from a tape drive

answer of 0 = machine CANNOT boot from tape drive

 

diag -c -d (tape device)Hardware reset a tape drive.

diag -c -d rmt0

 

tapechk (No of files) Checks Number of files on tape.

 

< /dev/rmt0 Rewinds the tape !!!

 

 

--------------------------------------------------------------------------------

PRINTERS / PRINT QUEUES

--------------------------------------------------------------------------------

 

splp (device) Displays/changes printer driver settings

splp /dev/lp0

 

export $LPDEST="pqname" Set default printer queue for login session

 

lsvirprtLists/changes virtual printer attributes.

 

lsallqDisplays all queues

 

rmvirprt -q queuename -d queuedeviceRemoves a virtual printer

 

qpri -#(job No) -a(new priority)Change a queue job priority.

 

qhld -#(job No)Put a hold on hold

qhld -r #(job No)Release a held job

 

qchk -AStatus of jobs in queues

lpstat

lpstat -p(queue) Status of jobs in a named queue

 

qcan -x (job No) Cancel a job from a queue

cancel (job No)

 

enq -U -P(queue) Enable a queue

enable (queue)

 

enq -D -P(queue) Disable a queue

disable (queue)

 

qmov -m(new queue) -#(job No)Move a job to another queue

 

startsrc -s qdaemonStart qdaemon sub-system

lssrc -s qdaemon List status of qdaemon sub-system

stop -s qdaemonStop qdaemon sub-system

 

 

 

 

我的主页:http://tlcshxd.3322.org/index.html

 

第 31 讲:FILE SYSTEMS

 

 

Physical Volumes (PV's)

-----------------------

 

lspvLists all physical volumes (hard disks)

lspv (pv) Lists the physical volume details

lspv -l (pv)Lists the logical volumes on the physical volume

lspv -p (pv)Lists the physical partition usage for that PV

lspv -M (pv)Lists the PP allocation table for that PV.

 

If the PV state is "missing" but the disk is okay, use "varyonvg vg" to change

the state of the PV to "active".

 

chdev -l (pv) -a pv=yes Makes a new hdisk a pysical volume.

 

chpv -v r (pv)Removes a disk from the system.

chpv -v a (pv)Adds the removed disk back into the system.

chpv -a y (pv)Changes pv allocatable state to YES

chpv -a n (pv)Changes pv allocatable state to NO

 

migratepv (old pv) (new pv) Moves all LV's from one PV to another PV, both

PV's must be in the same volume group.

 

Migratepv cannot migrate striped logical volumes, use cplv and rmlv.

 

replacepv (old pv) (new pv) (4.3.3 onwards)

 

 

Volume Groups (VG's)

--------------------

 

lsvgLists all volume groups

lsvg (vg) Lists the volume group details

lsvg -l (vg)Lists all logical volumes in the volume group

lsvg -p (vg)Lists all physical volumes in the volume group

lsvg -o Lists all varied on volume groups

 

varyonvg (vg) Vary On a volume group

varyonvg -f (vg)Forces the varyon process

varyonvg -s (vg)Vary on a VG in maintenance mode. LV commands can be

used on VG, but LV,s cannot be opened for I/O.

varyoffvg (vg)Vary Off a volume group

 

synclvodm (vg)Tries to resync VGDA, LV control blocks and ODM.

synclvodm -v (vg) Rebuilds the LVCB.

(the vg needs to be varied on before running synclvodm)

 

 

mkvg -y(vg) -s(PP size) (pv)Create a volume group

mkvg -y datavg -s 4 hdisk1

 

reducevg (vg) (pv) Removes a volume group

reducevg -d (vg) (pv)Removes a volume group and delete all LV's on the PV

reducevg (vg) (PVID) Removes the PVID disk reference from the VGDA when a

 disk has vanished without the reducevg (vg) (pv)

 command being run first.

reducevg -df (vg) (pv) Deletes all LV's from the VG and removes the VG

 from the disk. If the last disk in the VG then

 the VG is deleted.

 

extendvg (vg) (new pv) Adds another PV into a VG.

 

exportvg (vg)Exports the volume group, removes the VG entries and

 removes all FS entries from /etc/filesystems but

 leaves the mount points.

 

Note : Cannot export a VG if it has active paging space, turn off paging,

 reboot before exporting VG. Exporting removes entries from filesystems

 file but does not remove the mount points.

 

chvg -a y (vg)Auto Vary On a volume group at system start.

chvg -u (vg)Unlocks a locked volume group.

 

lqueryvg -Atp (pv)Details volume group info for the hard disk.

 

importvg -y (vg name) (pv)Import a volume group from a disk.

importvg (pv) Same as above but VG will be called vg00 etc.

 

4.3 onwards, importvg will automatically varyon the VG.

 

chvg -Q (y/n) (vg name) Turns on/off Quorum checking on a VG.

 

reorgvg (vg) (lv)Reorganised a fragmented LV, must state an LV at the

 command line else the first LV in the VG is picked.

 Does not reorg the PP's of striped LV's.

 

 

 

Logical Volumes (LV's)

----------------------

 

lslv (lv) Lists the logical volume details

lslv -l (lv)Lists the physical volume which the LV is on

lsattr -EHl (lv)Displays more logical volume details

 

mklv (vg) (No of PP's) (pv Name optional) Create a logical volume

mklv -y (lv) (PP's) (pv name optional)Creates a named logical volume

( use -t jfs2 when creating an LV for a JFS2 filesystem

 

 

chlv -n (new lv) (old lv) Rename a logical volume

chlv -x (number) (lv) Change max no of PP's

chlv -s n (lv)Turns of strickness on the LV

extendlv (lv) (extra No of PP's)Increase the size of an LV

rmlv (lv) Remove a logical volume

 

cplv -v (vg to copy to) -y (new lv) (lv)Copy an LV to a new LV

 

If copying a filesystem LV, umount the filesystem before copying, otherwise you

will have to fsck the the new LV before the filesystem can be mounted.

If copying a striped LV to an LV that is already created, and the stripe

size is different ( or not even striped , then these new parameters are

maintained when the data is copied to the new LV.

 

cplv -e (new lv) (old lv)Copy to an existing LV

( new lv must have type as copy use chlv -t copy (new lv) to change

 

mklv/extendlv -a = PP alocation policy

-am = middle -ac = center -ae = edge

-aie = inner edge-aim = inner middle

 

migratepv -l (lv) (old pv) (new pv)

Move a logical volume between physical volumes. Both physical volumes

must be in the same volume group !

 

mklv -y (lv) -t jfslog (vg) (No of PP's) (pv Name optional)

Creates a JFSlog logical volume.

 

logform (/dev/lv) Initialises an LV for use as an JFSlog

 

getlvcb -AT (lv)Displays Logical Volume Control Block information

 

File Systems (FS's)

-------------------

 

lsfsLists all filesystems

lsfs -q (fs)Lists the file system details

lsjfs Displays data about all filesystems in CSV style format

 

mount Lists all the mounted filesystems

mount (fs or lv)Mounts a named filesystem

mount -aMounts all filesystems

mount all

 

mount -r -v cdrfs /dev/cd0 /cdrommounts cd0 drive over /cdrom

 

crfs -v jfs -d(lv) -m(mount point) -A yes

Will create a file system on the whole of the logical volume, adds entry into

/etc/filesystems and will create mount point directory if it does not exist.

( use -v jfs2 for JFS2 filesystems

 

crfs -v jfs -g(vg) -m(mount point) -a size=(size of fs) -A yes

Will create a logical volume on the volume group and create the file system on

the logical volume. All at the size stated. Will add entry into

/etc/filesystems and will create the mount point directory if it does not exist.

 

Use attribute "-a log=/dev/log01" to specify a jfslog devices

Use attrubute "-a bf=true" for a large file enabled filesystem

 

chfs -A yes (fs) Change file system to Auto mount in

 /etc/filesystems

chfs -a size=(new fs size)(fs) Change file system size

chfs -m (new-mount-point) (fs) Change the file system mount point.

 

rmfs (fs)Removes the file system and will also remove the

 LV if there are no onther file systems on it.

 

defrag -q (fs) Reports the fragment status of the file system.

defragfs -r (fs) Runs in report only defrag mode (no action).

defragfs (fs)Defragments a file system.

 

fsck (fs)Verify a file system, the file system must be unmounted!

fsck (-y or -n) (fs) Pre-answer questions either yes or no !

fsck -p (fs) Will restore primary superblock from backup copy if the

 superblock is corrupt.

( or dd count=1 bs=4k skip=31 seek=1 if=/dev/lv00 of=/dev/lv00

 

Mirroring

---------

 

mklv -y (lv) -c(copies 2 or 3) (vg) (No of PP's) (PV Name optional)

Creates a mirrored named logical volume.

 

mklvcopy -s n (lv) (copies 2 or 3) (pv)

Creates a copy of a logical volume onto another physical volume. The physical

volume MUST be in the same volume group as the orginal logical volume !

 

rmlvcopy (lv) (copies 1 or 2) Removes logical volume copies.

rmlvcopy (lv) (copies 1 or 2) (pv)From this pv only!

 

syncvg -p (pv)Synchronize logical partion copies

syncvg -l (lv)

syncvg -v (vg)

 

mirrorvg (vg) (pv)

Mirrors the all the logical volumes in a volume group onto a new physical

volume. New physical volume must already be part of the volume group.

 

chfs -a splitcopy=/backup -a copy=2 /data1

Splits off a copy of a 3 way mirror and mount read only for use as an

offline backup.

 

--------------------------------------------------------------------------------

 BOOT LOGICAL VOLUME (BLV) / PROCESSORS / KERNEL

--------------------------------------------------------------------------------

 

Mirroring does not work with the BLV as it is not a true logical volume,

bosboot must be run against the other disk after mirroring the rootvg.

 

bootlist -m (normal or service) -o displays bootlist

bootlist -m (normal or service) (list of devices)change bootlist

 

bootinfo -bIdentifies the bootable disk

bootinfo -tSpecifies type of boot

 

bosboot -a -d (/dev/pv)Creates a complete boot image on a physical volume.

 

mkboot -c -d (/dev/pv) Zero's out the boot records on the physical volume.

 

savebase -d (/dev/pv)Saves customised ODM info onto the boot device.

 

lslv -m hd5Find out which disk the BLV is on.

 

bootinfo -yDisplays which kernel can be used, 32 or 64 bit

 

genkex Reports all loaded kernel extensions.

 

lsdev -Cc processorLists all processors

lsattr -EHl proc0Displays attributes of processor 0. AIX 5.1L will

 display processor clock frequency.

 

--------------------------------------------------------------------------------

SYSTEM DUMP

--------------------------------------------------------------------------------

 

1, AIX 4.2.1 and greater supports system dump to paging space.

2, AIX 4.3.3 and greater supports system dump to mirrored paging space.

3, Primary dump device must be in the rootvg

4, Secondary dump device can be outside rootvg unless it is a paging device.

 

sysdumpdev -lLists current dump destination.

sysdumpdev -eEstimates dumpsize of the current system in bytes.

sysdumpdev -LDisplays information about the previous dump.

 

sysdumpstart -pStarts a dump and writes to the primary dump device.

sysdumpstart -sStarts a dump and writes to the secondary dump device.

 

(MCA machine can also dump if key is in service position and the reset

button is pressed)

 

sysdumpdev -p (dump device) -PSets the default dump device, permanently

 

Analyse dump file :-

echo "stat\n status\n t -m" | crash /var/adm/ras/vmcore.0

 

snap -gfkD -o /dev/rmt0 Copy dump to tape to send to IBM support, uses tar.

 

--------------------------------------------------------------------------------

PAGING SPACE (PS's)

--------------------------------------------------------------------------------

 

lsps -aLists out all paging space

lsps -sDisplays total paging and total useage

lsps (ps)

 

swappon /dev/psActivates a paging device eg /dev/paging00

swappoff /dev/ps Deactivates a paging device ( AIX 5.x only

 

mkps -s(No of PP's) -n -a (vg)

mkps -s(No of PP's) -n -a (vg) (pv)

-n = don't activate/swapon now-a = activate/swapon at reboot

 

mklv -b n -t paging -y hd6 (vg) (No of PP's) (pv)

Creates paging space using the mklv command.

 

chps -a n (ps)Turns off paging space.

chps -s(No of PP's) (ps)Increases paging space.

chps -d(No of PP's) (ps)Decreases paging space ( AIX 5.x only

 

chlv -n (new name) (old name)Change paging space name

 

rmps (ps) Remove paging space. PS must have been turned off

and then the system rebooted before it can be removed.

 

Note : Need to change the swapon entry in /sbin/rc.boot script if you are

 changing the default paging space from /dev/hd6. You also need to

 do a "bosboot -a -d /dev/hdiskx" before the reboot.

 

/etc/swapspaces File that lists all paging space devices that are

activated/swapon during reboot.

 

--------------------------------------------------------------------------------

SCHEDULING

--------------------------------------------------------------------------------

 

crontab -lList out crontab entrys

crontab -eEdit crontab entrys

crontab -l > (filename) Output crontab entrys to a file

crontab (filename)Enter a crontab from a file

crontab -rRemoves all crontab entrys

crontab -vDisplays crontab submission time.

 

/var/adm/cron/cron.allowFile containing users allowed crontab use.

/var/adm/cron/cron.deny File containing users denied crontab use.

/var/adm/cron/crontab Directory containing users crontab entries.

/var/adm/cron/log Cron log file.

 

at (now + 2 minutes, 13:05, etc) {return}Schedule a job using at

Command or schell script {return}

{CTRL D}

 

echo "shutdown -Fr" | at now + 1 minute

 

at -l

atqLists out jobs scheduled to run via at command

 

at -r (at job No)

atrm(at job No)Removes an at job scheduled to run.

 

/var/adm/cron/at.allow File containing users allowed at use.

/var/adm/cron/at.denyFile containing users denied at use.

/var/adm/cron/atjobs Directory containing users at entries.

 

--------------------------------------------------------------------------------

SECURITY

--------------------------------------------------------------------------------

 

nulladm /var/adm/wtmpTo recreate/clear down the wtmp file.

 

groups Lists out the groups that the user is a member of

原创粉丝点击