bffcreate -d /dev/cd0 -t 将介质上的安装文件拷贝到指定目录供以后使用,-t指定保存的目录,如果不指定,保存到/usr/sys/inst.images/
inutoc 为保存的安装文件生成 .toc文件。
列出系统运行级别的变化历史
/usr/lib/acct/fwtmp
改变系统运行级别:
telinit N
/sbin/rc.boot 由init调用,在启动的不同阶段调用不同的参数。:
Booting from disk (boot phase 1)
Varying on a root volume group (boot phase 2)
Enabling file systems (boot phase 2)
Calling the BOS installation programs or diagnostics
/etc/rc 用于rc.boot之后启动系统
Vary on all volume groups marked as auto-varyon.
Activate all paging spaces listed on /etc/swapspaces (using the swapon -a
command).
Configure all dump devices (using the sysdumpdev -q command).
Perform file system checks (using the fsck -fp command).
Perform mounting of file systems marked as mount=true on the
/etc/filesystems file (using the mount all command).
/etc/rc.net 启动网络
/etc/rc.tcpip启动tcpip服务
inetd (started by default)
gated
routed
named
timed
rwhod
There are also daemons specific to the base operating system or to other
applications that can be started through the rc.tcpip file. These daemons are:
lpd
portmap
sendmail
syslogd
第五章,系统配置
ODM包含的主要内容(主要的class列表):
Predefined device information: PdDv, PdAt, and PdCn
Customized device information: CuDv, CuAt, and CuDep
Software vital product data: history, inventory, lpp, and product
SMIT menus: sm_menu_opt, sm_name_hdr, sm_cmd_hdr, and sm_cmd_opt
Error log, alog and dump information: SWservAt
System Resource Controller: SRCsubsys and SRCsubsvr
Network Installation Manager: nim_attr, nim_object, and nim_pdattr
ODM的位置:
/usr/lib/objrepos:包含预定义的设备信息,SWVPD for /usr
/usr/share/lib/objrepos:包含 SWVPD for /usr/share
/etc/objrepos:包含当前系统的设备信息,SWVPD for /
odmget:查询odm信息:
odmget -q "type LIKE lv*" PdDv
odmget lpp
odmget history|grep -p "lpp_id = 100"
odmget -q name=hdisk0 CuAt
NFS系统主要的服务:
NFS Server:
/usr/sbin/rpc.mountd 用于客户端的文件系统mount
/usr/sbin/nfsd 用于处理客户端的NFS I/O
NFS Client:
/usr/sbin/mount 同服务器的rpc.mountd通信,用于mount NFS文件系统
/usr/sbin/biod 同服务器的nfsd通信,用于处理NFS I/O
启动nfs服务
启动单独的服务进程 startsrc -s nfsd
启动整个NFS服务 startsrc -g nfs
验证 lssrc -g nfs
export共享目录:
1、smitty mknfsexp
2、/usr/sbin/exportfs -a
在客户机上验证:
showmount -e ServerName
临时共享某个目录,不修改/etc/exports
exportfs -i /dirname
删除共享目录:
exportfs -u dirname
自动mount NFS文件系统
smitty mknfsmnt
或修改 /etc/filesystems (自动mount NFS文件系统应加上bg,intr参数防止启动故障)
网络配置
/etc/rc.tcpip 用于在系统启动时初始化TCP/IP服务
/etc/tcp.clean 用于停止TCP/IP服务,但不停止portmap和nfs
不要使用strtsrc -g tcpip启动网络服务,使用startsrc -s
刷新inetd,修改配置后使用以下命令刷新inetd
refresh -s inetd
或者用
kill -1 PID
lssrc -ls inetd 检查当前inetd启用了哪些服务
缺省的域名解析顺序:
DNS-NIS-LOCAL
修改/etc/netsvc.conf可以更改默认顺序:
#cat /etc/netsvc.conf
hosts = nis, local, bind
# export NSORDER=bind,nis,local 设置NSORDER环境变量可以覆盖缺省的顺序
/etc/resolve.conf 配置DNS服务器
添加路由:
使用 route add -net 192.168.1 -netmask 255.255.255.0 9.3.1.124
或者使用smitty mkroute
lsdev -Cc if 查看当前系统中定义的网络接口
ifconfig tr0 10.1.2.3 netmask 255.255.255.0 alias 建立别名
ifconfig tr0 10.1.2.3 netmask 255.255.255.0 delete 删除别名,如果不指定地址,该命令将删除主地址
lsattr -El en0 可以查看MTU Size
/etc/hosts.equiv, .rhosts, .netrc, .forward 权限都应该设为600
/etc/hosts.equiv 和 $HOME/.rhosts 用于配置信任主机和用户,权限应设为600 root用户只使用 $HOME/.rhosts
格式:[ + | - ] HostName [ + | - ] UserName or @NetGroup (注意:配置文件是根据顺序从上到下一条条执行的)
lscfg |grep -i adapter 列出所有的适配卡
smitty chgenet 修改网卡属性,speed,duplex等等。
lsdev -Cc if 列出所有的网络接口(en是逻辑接口,上面列出的ent是物理接口)
从系统中删除网卡的步骤:
1:ifconfig interface down
2: ifconfig interface detach
3: rmdev -dl interface
4: rmdev -dl adapter
5: PowerOff
6: remove adapter
Paging Space配置
lsps -a 显示paging Space信息
chps -s 3 hd6 为Paging Space 增加3个LP大小的空间
chps -d 1 hd6 为Paging Space 减少1个LP大小的空间(hd6不能低于32M)
不要将hd6放在rootvg以外的其它vg里面,因为在系统启动的时候,只有rootvg是可以访问的。
migratepv -l hd6 hdisk0 hdisk1 将Paging Space 移动到同一vg中的另一个PV
删除Paging Space(除了hd6之外)不需要重启:
1:swapoff /dev/paging00
2: rmps paging00
设备管理:
lscfg -vp 显示系统中的设备信息
lscfg -vl 设备名 显示某个设备的具体信息(位置,微码版本,FRU等等)
lsdev -C显示当前ODM中的设备信息
lsdev -P显示预定义的ODM设备信息
lsattr -El proc0 显示CPU的详细信息(CPU型号,频率等等)
lsattr -El sys0 | grep realmem 显示系统中有多少内存
rmdev -dl rmt0 从ODM中删除设备
chdev -l sys0 -a maxuproc=100 修改系统每个用户的最大进程数
SMT简单配置
lsdev -Cc processor 显示系统中的物理CPU个数
bindprocessor -q 显示系统中当前逻辑CPU个数
lsattr -E -l proc0
frequency 1654344000 Processor Speed False
smt_enabled true Processor SMT enabled False
smt_threads 2 Processor SMT threads False
state enable Processor state False
type PowerPC_POWER5 Processor type False
smtctl -m off -w now 立即关闭SMT
smtctl -m on -w boot 下次重启时打开SMT
32位和64位的切换
bootinfo -y显示硬件平台是32位还是64位
切换内核
# ln -sf /usr/lib/boot/unix_64 /unix
# ln -sf /usr/lib/boot/unix64 /usr/lib/boot/unix
# bosboot -ad /dev/ipldevice
bosboot: Boot image is 23137 512 byte blocks.
# shutdown -r
第六章 存储管理
PV
chdev -l hdisk7 -a pv=yes 给PV加上PVID
lspv -M hdisk0 查看hdisk0的PP分布
lquerypv -h /dev/hdisk2 80 10 查询某个PV的PVID
lquerypv -M hdisk0 查询hdisk0的LTG size
migratepv 将PV数据移到另一个PV(可指定逻辑卷迁移)
migratelp 在PV之间移动指定的pp
chpv -hy hdisk4 指定某个PV为hotspare盘,hotspare盘必须为空。
chpv -c hdisk1 清除hdisk1上的boot record
VG
AIX5.3支持3种格式VG normal,scalable,big
mkvg -y vg1 -s64 -V99 hdisk4 在hdisk4上建一个名为vg01,pp size=64M,major number=99的vg
chvg -Qn testvg 关掉VG的quorum
chvg -G testvg将普通VG转为scalable VG,一旦转化成功,VG将不能import到5.3以下的AIX环境。
chvg -L 128 testvg 改变VG的LTG size (LGT size 必须小于VG中所有PV的最大传输速率的最小者:The new LTG size should be
less than or equal to the smallest of the maximum transfer size of all disks in the volume group.)
chvg -hy testvg 打开VG的hotspare开关(一对一) chvg -hn testvg 关闭hotspare开关
chvg -hY testvg 打开VG的hotspare开关(一对多)
chvg -sy test1vg 设置VG自动同步状态异常的逻辑卷(仅对镜像过的 LV有效)chvg -sn testvg 关闭自动同步开关。
chvg -P 2048 testvg 设置VG中最大PP数量(单位是K)
chvg -v 4096 testvg 设置VG中的最大LV数量
chvg -t 16 testvg 设置VG中每个PV最大的PP数量
extendvg 用于将PV扩到现有的VG上,在AIX5.3当中,如果VG是用varyonvg -M 命令varyon的或者是在AIX5.3以前的版本上创建的,那么如果新增的PV的LGT size 小于VG的
LTG size,entendvg命令将失败,如果VG没有用varyonvg -M命令varyon,系统会自动调整现有VG的LTG size.
reducevg用于从VG中移出PV,reducevg也会自动调整VG的LTG size,除非使用了varyonvg -M 命令.
synclvodm testvg 将VG中最新的VG信息同步到ODM库当中,可用于ODM损坏时的措施之一,执行命令时VG必须varyon
varyonvg -f testvg 强制激活VG
varyonvg -n testvg 激活VG,但不调用syncvg同步逻辑卷。
splitvg -y newvg -c 1 test1vg 将一个mirror VG testvg的镜像拆除一份并建立一个新的snapshot VG newvg 。
LV
lslv -n hdisk6 testlv 从hdisk6上的VGDA中读取关于testlv的信息,不管testlv是否在hdisk6上
getlvcb -AT lv1 显示LVCB信息
cplv -v dumpvg -y lv9 lv1 将lv1拷贝到 dumpvg里的lv9上。
chlv -d pr lv1 修改LV的读写策略,有以下几种策略:
p
Establishes a parallel scheduling policy.
ps
Parallel write with sequential read policy. All mirrors are written in
parallel but always read from the first mirror if the first mirror is
available.
pr
Parallel write round robbin read. This policy is similar to the parallel
policy except an attempt is made to spread the reads to the logical volume
more evenly across all mirrors.
s
Establishes a sequential scheduling policy.
mklvcopy 镜像逻辑卷
splitlvcopy 分离逻辑卷的镜像(分离到另一个LV)
rmlvcopy 删除逻辑卷镜像
第七章:文件系统
lsfs -q 列出文件系统的详细信息(包括fs size fragment size nbpi 等等)
重建jfslog:
1、使用mklv命令建立lv,类型为jfslog和jfs2log
2、logform /dev/loglv01 对jfslog进行初始化。
istat /etc/passwd 列出某个文件的inode信息
如何从备份的超级块恢复数据:
dd count=1 bs=4k skip=31 seek=1 if=/dev/lv00 of=/dev/lv00
fuser 列出正在使用某个文件系统的进程。
find /home -type d -exec fuser -u {} \;
genkex 列出系统中所有的 kernel extensions。
第8章:系统监控和性能调优
1:FS监控
quotaon/quotaoff 打开/关闭文件系统限额
edquota -p gpsilva tneiva 复制用户gpsilva的限额设置到tneiva
who /etc/security/failedlogin 检查失败的登录日志
find / -xdev -size +2048 -ls |sort -rn +6 查找 / 目录下大于1K的文件并按从大到小排序。
find /filesystem_name -xdev -mtime 0 -ls 查找最近24小时修改过的文件
如何删除wtmp文件里面的陈旧内容:
/usr/sbin/acct/fwtmp < /var/adm/wtmp >/tmp/out
编辑 /tmp/out文件,删除历史纪录
/usr/sbin/acct/fwtmp -ic < /tmp/out > /var/adm/wtmp
如何清理系统错误日志:
Never use the cp /dev/null command to clear the error log. A zero
length errlog file disables the error logging functions of the operating
system and must be replaced from a backup.
/usr/lib/errstop
rm /var/adm/ras/errlog
/usr/lib/errdemon
vi -r 列出可恢复的vi编辑
vi -r 文件名 恢复中断的VI编辑
/var/preserve 目录保存了中断的VI编辑文件,通常情况下可以删除。
/var/tmp/snmpd.log 可能会很大,可编辑/etc/snmpd.conf 设置日志文件的最大值。
/usr/lib/errdemon -l 确定errlog文件的位置
/usr/lib/errdemon -s 2000000 改变errlog文件的大小
errpt -s 1122164405 -e 1123100405 显示指定日期的错误日志
errclear 0 清除所有错误日志
errlogger 将信息记录到系统错误日志当中。
/usr/lib/errdead /dev/hd7 从系统dump文件中提取错误日志(执行命令时要先停掉errdemon)
netstat -m 显示网络缓存的使用情况
netstat -v 显示网卡的驱动信息(包括设备类型,MAC地址,当前传输速率,错误统计信息等)
netstat -s(p) 显示协议相关的统计信息。
iostat -A 显示AIO统计信息
iostat -t 显示CPU/TTY统计信息
iostat -AQ 显示文件系统的运行队列信息
iostat -a 显示适配卡的统计信息
/proc进程监控命令集:
procfiles Reports information about all file descriptors opened by
processes.
proctree Prints the process tree containing the specified process IDs or
users.
procsig Lists the signal actions defined by processes.
procstack Prints the hexadecimal addresses and symbolic names for all the
threads in the process.
procrun Starts a process that has stopped on the PR_REQUESTED
event.
procmap Prints the address space map of processes.
procflags Prints the /proc tracing flags, the pending and held signals, and
other /proc status information for each thread in the specified
processes.
proccred Prints the credentials (effective, real, saved user IDs, and group
IDs) of processes.
procldd Lists the objects loaded by processes, including shared objects
explicitly attached using dlopen().
procwait Waits for all of the specified processes to terminate.
procwdx Prints the current working directory of processes.
procstop Stops processes on the PR_REQUESTED event.
/etc/tunables目录包含了系统中可调的参数(schedo, vmo, ioo, raso, no,nfso)
nextboot 包含下次启动时生效的参数
lastboot 最近一次起动时的参数
常用命令如下:
tunsave Saves current tunable parameter values to a file (backup).
tunrestore Restores tunable parameter values from a file.
tuncheck Validates a tunable file.
tunchange Updates one or more tunable stanzas in a file.
tundefault Reset all tunable parameters to their default value.
lsslot -c pci 显示系统中的PCI插槽状态。
lsmcode -c 显示系统微码版本
lsmcode -A 显示所有设备的微码版本(内置硬盘,光纤卡,内置磁带机等等)
lscfg -vp 显示系统VPD信息
prtconf 显示系统配置信息
lsrsrc 显示RSCT的类
xlpstat 监控LPAR的性能情况
第9章:错误诊断和解决
系统dump,缺省的dump设备是hd6,如果系统内存大于4G,dump设备改为lg_dumplv.
sysdumpdev -P -p /dev/dumpdev 修改缺省dump设备
sysdumpdev -L 显示上一次dump的信息
sysdumpdev -e 计算dump大小
lsattr -El sys0 -a autorestart 显示是否设置了dump后自动重启
dump时面板产生的 code格式:
888.102.xxx.xxx.888结束
第一个xxx表示crash code:
以 3,4,7开头的多为软件问题
以 2,5,8开头的多为硬件问题
特别的,000:Unexpected system interrupt.
558:There is not enough memory to continue the IPL.
第二个xxx表示dump code,显示了系统dump当前的状态。
0c0 正常结束 0c4空间不足
使用pax打包(pax可打包超过2G的文件)
pax -x pax -wvf /dev/rmt0 /var/adm/ras/cfglog /var/adm/ras/nimlog
使用pax解开tar包
pax -rvf /tmp/test.tar
将run.pax拷贝到/tmp目录
pax -rw run.pax /tmp
用snap命令收集系统信息
/usr/sbin/snap -gfkD -o /dev/rmt0
echo " boot log resizing" | alog -t boot -s 8192 改变bootlog大小
usrck -n ALL 检查所有用户
grpck -n ALL 检查组
检查并修复软件包安装的一致性(文件权限,大小,连接数等)
sysck -i -f smart.rte.inventory smart.rte
卸载软件后清理相关的文件,连接等等。
sysck -u -f smart.rte.inventory smart.rte
lsuser/lsgroup -f 以小结的格式显示用户/组的信息
lsuser/lsgroup -c 以列的格式显示用户/组的信息
不同情况下更换磁盘的步骤:
9.8.1 Scenario 1
If the disk you are going to replace is mirrored, we recommend following these
steps:
1. Remove copies of all logical volumes that were residing on that disk using
either the rmlvcopy command or unmirrorvg command.
2. Remove the disk from the volume group using the reducevg command.
3. Remove the disk definition using the rmdev command.
4. Physically remove the disk. If the disk is not hot-swappable, you may be
required to reboot the system.
5. Make the replacement disk available. If the disk is hot-swappable, you can run
cfgmgr; otherwise, you may need to reboot the system.
6. Include the newly added disk into the volume group using the extendvg
command.
7. Recreate and synchronize the copies for all logical volumes using either
mklvcopy or mirrorvg.
9.8.2 Scenario 2
If the disk you are going to replace is not mirrored and is still functional, we
recommend following these steps:
1. Make the replacement disk available. If the disk is hot-swappable, you can run
cfgmgr; otherwise, you may need to reboot the system.
2. Include the newly added disk into the volume group using the extendvg
command.
3. Migrate all partitions from the failing disk to the new disk using either the
migratepv command or the migratelp command. If the disks are part of the
rootvg, you should consider the following:
– If the disk to be replaced contains a copy of the BLV, you have to clear it
using the chpv -c command.
– A new BLV image must be created on the new disk using the bosboot
command.
– The bootlist must be updated to reflect these changes using the bootlist
command.
– If the disk to be replaced contains a paging space or a primary dump
device, you should disable them. After the migratepv command
completes, you should reactivate them.
4. Remove the failing disk from the volume group using the reducevg command.
5. Remove the disk definition using the rmdev command.
9.8.3 Scenario 3
If the disk is not mirrored, has failed completely, and there are other disks
available in the volume group, we recommend following these steps:
1. Identify all logical volumes that have at least one partition located on the failed
disk.
2. Close the logical volumes and unmount all the corresponding file systems
using the umount command.
3. Remove the file systems and logical volumes using the rmfs command.
4. Remove the failing disk from the volume group using the reducevg command.
5. Remove the disk definition using the rmdev command.
6. Physically remove the disk. If the disk is not hot-swappable, you may be
required to reboot the system.
7. Make the replacement disk available. If the disk is hot-swappable, you can run
cfgmgr; otherwise, you may need to reboot the system.
8. Include the newly added disk into the volume group using the extendvg
command.
9. Recreate all the logical volumes and the corresponding file systems using the
mklv command and the crfs command.
10.If you have a backup of your data, restore your data from backup.
9.8.4 Scenario 4
If the disk is not mirrored, has failed completely, there are no other disks available
in the volume group (the volume group contained only one physical volume or all
the physical volumes failed simultaneously), and the volume group is not rootvg,
we recommend the following steps:
1. Export the volume group definition from the system using the exportvg
command.
2. Ensure that /etc/filesystems does not contain any incorrect stanzas.
3. Remove the disk definition using the rmdev command.
4. Physically remove the disk. If the disk is not hot-swappable, you may be
required to reboot the system.
5. Make the replacement disk available. If the disk is hot-swappable, you can run
cfgmgr; otherwise, you may need to reboot the system.
6. If you have a volume group backup, restore it using the restvg command.
7. If you do not have volume group backup, recreate the volume group, all the
logical volumes, and the corresponding file systems using the mkvg command,
the mklv command, and the crfs command.
8. If you have a backup of your data, restore your data from backup.
9.8.5 Scenario 5
If the disk is not mirrored, has failed completely, there are not other disks
available in the volume group (the volume group contained only one physical
volume or all physical volumes failed simultaneously), and the volume group is
rootvg, we recommend following these steps:
1. Replace the failing disk.
2. Boot the system in maintenance mode.
3. Restore the system from an mksysb image.
启动CDE时系统hang 主要原因有:
1:/home 满了
2:无法解析主机名(修改了IP底之后没有修改/etc/host文件会出现这种情况)
无法打开显示时,采用以下步骤:
在远程主机server2上设置DISPLAY环境变量
export DISPLAY=server3:2.0
在server3上运行xhost命令允许连接
xhost +server2
终端显示异常时,设置TERM环境变量
export TERM=vt100
perfpmr 下载地址:
运行perfpmr必须安装的包
bos.acct
bos.sysmgt.trace
perfagent.tools
bos.net.tcp.server
bos.adt.include
bos.adt.samples
第十章:备份和恢复
mksysb备份带的结构:
1、BOS boot image
2、mkinsttape image(包括三个文件:./tapeblksz ./bosinst.data ./image.data)
3、dummy.toc
4、rootvg data...
mksysb -e /dev/rmt0 备份系统,但不备份 /etc/exclude.rootvg文件中指定的文件。
smitty lsmksysb 列出mksysb备份的内容
smitty restmksysb 从mksysb备份中恢复某个文件(文件名前必须使用./)
savevg -ivf /dev/rmtxx uservg 备份VG中的文件系统
find /userdirectory -depth | backup -ivf /dev/rmtxx
find /userdirectory -depth | cpio -ocvB > /dev/rmtxx
不同的备份策略之间的区别:
full: 全备份
differences: 只备份在上次full备份后修改过的文件,恢复时需要full+最近一次的备份介质
incremental: 只备份在上次备份后修改过的文件,恢复时需要从上一次full备份至今的所有备份介质
savevg -r 只备份VG的结构,不备份数据
restvg -r 同上
tcopy /dev/rmt0 校验磁带
第十一章:日常管理
rmuser -p 删除用户(包括/etc/security/passwd中的信息)
rmuser 删除用户(不删除/etc/security/passwd中的信息)
chsec -f /etc/security/user -s default -a logintimes=:0800-1700 修改用户安全属性,可指定以下文件
/etc/security/environ
/etc/security/group
/etc/security/lastlog
/etc/security/limits
/etc/security/login.cfg
/usr/lib/security/mkuser.default
/etc/security/passwd
/etc/security/portlog
/etc/security/user
who -r 显示当前主机的运行级别
ps -emo THREAD 显示当前系统中的所有进程和线程
fuser -xc /tmp 列出使用某个文件系统的进程号
fuser -kxuc /home 杀掉当前正在使用某个文件的进程
find /home -type d -exec fuser -u {} \; 找出当前正在使用/home目录或其子目录作为工作目录的进程。
chdev -l sys0 -a maxuproc=256 改变单个用户的最大进程数(增大立即生效,减小需要重启后生效)
stty -a 显示终端设置
在前台运行程序时,可用 ^Z暂时中止程序,回到命令提示符,然后执行fg 继续在前台运行命令,用于被 ^Z暂时中止的命令的恢复执行。
单引号使所有里面的符号失效
单引号不能嵌套单引号
双引号使除了 $ ` \ 之外的符号失效
# echo "$H $W $((8+2)) times"
Hello world 10 times
# echo "This host's name is: `hostname`"
This host's name is: server2
# echo "\"hello\""
"hello"
echo "Value of \$H variable is: $H"
Value of $H variable is: Hello
通配符示例:
1、
echo "Active vgs on: `date +\"%D %H:%M:%S\"`\n$(lsvg -o)"
Active vgs on: 11/14/05 18:00:44
testvg
rootvg
2、
1.Using double quotation marks:
# mkitab "echomsg:2:once:echo \`date +\"%m/%d/%y\"\` >> /tmp/echomsgs"
#
The result on the /etc/inittab file will look like:
# lsitab echomsg
echomsg:2:once:echo `date +"%m/%d/%y"` >> /tmp/echomsgs
#
If you avoid escaping backquotes, the result looks like:
# mkitab "echomsg:2:once:echo `date +\"%m/%d/%y\"` >> /tmp/echomsgs"
# lsitab echomsg
echomsg:2:once:echo 11/16/05 >> /tmp/echomsgs
#
which is not compliant with our objective, because the output is statically set
to 11/16/05 in this example.
2. Using single quotation marks:
# mkitab 'echomsg:2:once:echo `date +"%m/%d/%y"` >> /tmp/echomsgs'
# lsitab echomsg
echomsg:2:once:echo `date +"%m/%d/%y"` >> /tmp/echomsgs
cat file1 file2 file3 > file4 连接文件