AIX--222读书笔记 第三章:安装三种安装的区别汇总表:Table 3-1 AIX 5L BOS installation methodsInstallation steps New and complete overwrite Preservation MigrationCreate rootvg Yes No NoCreate file system /, /usr, /var Yes Yes NoCreate file system /home Yes No NoSave configuration No No YesRestore BOS Yes Yes YesInstall additional filesets Yes Yes YesRestore configuration No No Yes使用mksysb恢复时可选择是否安装设备驱动,通过编辑bosinst.data文件,确定是否恢复设备驱动A list of useful LED codes and their specific explanation when installing on anAIX 5L operating system are as follows:c40 Configuration files are being restored.c41 Could not determine the boot type or device.c42 Extracting data files from diskette.c43 Cannot access the boot/install tape.c44 Initializing installation database with target disk information.c45 Cannot configure the console.c46 Normal installation processing.c47 Could not create a physical volume identifier (PVID) on disk.c48 Prompting you for input.c49 Could not create or form the JFS log.c50 Creating root volume group on target disks.c51 No paging devices were found.c52 Changing from RAM environment to disk environment.c53 Not enough space in the /tmp directory to do a preservationinstallation.c54 Installing either BOS or additional packages.c55 Could not remove the specified logical volume in a preservationinstallation.c56 Running user-defined customization.c57 Failure to restore BOS.c58 Displaying message to turn the key.c59 Could not copy either device special files, device ODM, or volumegroup information from RAM to disk.c61 Failed to create the boot image.c62 Loading platform dependent debug files.c63 Loading platform dependent data files.c64 Failed to load platform dependent data files.系统缺省的bundles列表在/usr/sys/inst.data/sys_bundles 用户定义的在/usr/sys/inst.data/user_bundles文件版本号的格式:Version.Release.Modification.FixLevelinstallp常见选项:installp -agX 以apply方式安装软件,X表示自动扩展文件系统,g表示自动安装需要的其他软件installp -acgXd dir fileset 以commit方式安装软件,d指定安装文件目录,fileset指定要安装的fileset。
installp -acpX 安装预览installp -cgX all commit所有软件installp -r rejec安装过的软件,恢复到以前的版本installp -u 卸载软件installp -C 清除错误安装的软件installp -L -d /dev/cd0 列出介质上的软件包lslpp常见选项lslpp -l 列出所有安装的软件当前的版本号lslpp -f fileset 列出某个fileset包含的文件lslpp -h fileset 列出某个fileset的安装和更新历史instfix常见选项instfix -T -d /dev/cd0 列出介质上的补丁instfix -ik IY73748 根据APAR号查询是否打过某个补丁instfix -aik IY73748 根据APAR号查询某个补丁的详细信息instfix -i | grep ML 检查当前系统的ML(Maintenance Level)instfix -k IY73748 -d /dev/cd0 安装某个补丁bffcreate -d /dev/cd0 -t 将介质上的安装文件拷贝到指定目录供以后使用,-t指定保存的目录,如果不指定,保存到/usr/sys/inst.images/inutoc 为保存的安装文件生成 .toc文件。
lppchk -c fileset 校验指定的filesetlppchk -v 检查/ /usr /usr/share中记载的软件的一致性第四章:启动boot LED code:LED 201 - Damaged boot imageLED 223-229 - Invalid boot listLED 551, 555, and 557 - Corrupted file system, corrupted JFS log, and so onLED 552, 554, and 556 - Super block corrupted and corrupted customized ODMdatabaseLED 553 - Corrupted /etc/inittab fileLED c31: Console not yet configured. Provides instructions to select console.LED c32: Console is an LFT terminal.bootlist 常见选项bootlist -m normal -o 显示当前设定的bootlistbootlist -m normal hdisk0 hdisk1 修改bootlist系统运行级别Table 4-4 Run levels available on AIX 5LRun level Description0-1 Reserved for the future use of the operating system.2 Contains all of the terminal process and daemons that are run in themultiuser environment. This is the default run level.3-9 Can be defined according to the user’s preferencesa,b,c,h These are not true run levels; they differ from run levels in that the initcommand cannot request the entire system to enter these run levels.See 4.3, “The /etc/inittab file” on page 98 for more information.S,s,M,m Maintenance mode. When the system enters maintenance mode fromanother run level, only the system console is used as the terminal.Run level Description显示当前系统的运行级别cat /etc/.init.state列出系统运行级别的变化历史/usr/lib/acct/fwtmp
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 -acommand). 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/ 启动网络/etc/rc.tcpip启动tcpip服务 inetd (started by default) gated routed named timed rwhodThere are also daemons specific to the base operating system or to otherapplications 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_pdattrODM的位置:/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*" PdDvodmget lppodmget history|grep -p "lpp_id = 100"odmget -q name=hdisk0 CuAtNFS系统主要的服务:NFS Server:/usr/sbin/rpc.mountd 用于客户端的文件系统mount/usr/sbin/nfsd 用于处理客户端的NFS I/ONFS 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 nfsexport共享目录:1、smitty mknfsexp2、/usr/sbin/exportfs -a在客户机上验证:showmount -e ServerName临时共享某个目录,不修改/etc/exportsexportfs -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,修改配置后使用以下命令刷新inetdrefresh -s inetd或者用 kill -1 PIDlssrc -ls inetd 检查当前inetd启用了哪些服务缺省的域名解析顺序:DNS-NIS-LOCAL修改/etc/netsvc.conf可以更改默认顺序:#cat /etc/netsvc.confhosts = 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 mkroutelsdev -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 down2: ifconfig interface detach3: rmdev -dl interface4: rmdev -dl adapter5: PowerOff6: remove adapterPaging 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/paging002: 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 Falsesmt_enabled true Processor SMT enabled Falsesmt_threads 2 Processor SMT threads Falsestate enable Processor state Falsetype PowerPC_POWER5 Processor type Falsesmtctl -m off -w now 立即关闭SMTsmtctl -m on -w boot 下次重启时打开SMT32位和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/ipldevicebosboot: Boot image is 23137 512 byte blocks.# shutdown -r第六章 存储管理PVchdev -l hdisk7 -a pv=yes 给PV加上PVIDlspv -M hdisk0 查看hdisk0的PP分布lquerypv -h /dev/hdisk2 80 10 查询某个PV的PVID lquerypv -M hdisk0 查询hdisk0的LTG sizemigratepv 将PV数据移到另一个PV(可指定逻辑卷迁移)migratelp 在PV之间移动指定的ppchpv -hy hdisk4 指定某个PV为hotspare盘,hotspare盘必须为空。
chpv -c hdisk1 清除hdisk1上的boot recordVGAIX5.3支持3种格式VG normal,scalable,bigmkvg -y vg1 -s64 -V99 hdisk4 在hdisk4上建一个名为vg01,pp size=64M,major number=99的vgchvg -Qn testvg 关掉VG的quorumchvg -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必须varyonvaryonvg -f testvg 强制激活VGvaryonvg -n testvg 激活VG,但不调用syncvg同步逻辑卷splitvg -y newvg -c 1 test1vg 将一个mirror VG testvg的镜像拆除一份并建立一个新的snapshot VG newvg 。
LVlslv -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和jfs2log2、logform /dev/loglv01 对jfslog进行初始化。
istat /etc/passwd 列出某个文件的inode信息如何从备份的超级块恢复数据:dd count=1 bs=4k skip=31 seek=1 if=/dev/lv00 of=/dev/lv00fuser 列出正在使用某个文件系统的进程find /home -type d -exec fuser -u {} \; genkex 列出系统中所有的 kernel extensions第8章:系统监控和性能调优1:FS监控quotaon/quotaoff 打开/关闭文件系统限额 edquota -p gpsilva tneiva 复制用户gpsilva的限额设置到tneivawho /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 zerolength errlog file disables the error logging functions of the operatingsystem 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.rtelsuser/lsgroup -f 以小结的格式显示用户/组的信息lsuser/lsgroup -c 以列的格式显示用户/组的信息不同情况下更换磁盘的步骤:9.8.1 Scenario 1If the disk you are going to replace is mirrored, we recommend following thesesteps:1. Remove copies of all logical volumes that were residing on that disk usingeither 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 berequired to reboot the system.5. Make the replacement disk available. If the disk is hot-swappable, you can runcfgmgr; otherwise, you may need to reboot the system.6. Include the newly added disk into the volume group using the extendvgcommand.7. Recreate and synchronize the copies for all logical volumes using eithermklvcopy or mirrorvg.9.8.2 Scenario 2If the disk you are going to replace is not mirrored and is still functional, werecommend following these steps:1. Make the replacement disk available. If the disk is hot-swappable, you can runcfgmgr; otherwise, you may need to reboot the system.2. Include the newly added disk into the volume group using the extendvgcommand.3. Migrate all partitions from the failing disk to the new disk using either themigratepv command or the migratelp command. If the disks are part of therootvg, you should consider the following:– If the disk to be replaced contains a copy of the BLV, you have to clear itusing the chpv -c command.– A new BLV image must be created on the new disk using the bosbootcommand.– The bootlist must be updated to reflect these changes using the bootlistcommand.– If the disk to be replaced contains a paging space or a primary dumpdevice, you should disable them. After the migratepv commandcompletes, 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 3If the disk is not mirrored, has failed completely, and there are other disksavailable in the volume group, we recommend following these steps:1. Identify all logical volumes that have at least one partition located on the faileddisk.2. Close the logical volumes and unmount all the corresponding file systemsusing 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 berequired to reboot the system.7. Make the replacement disk available. If the disk is hot-swappable, you can runcfgmgr; otherwise, you may need to reboot the system.8. Include the newly added disk into the volume group using the extendvgcommand.9. Recreate all the logical volumes and the corresponding file systems using themklv command and the crfs command.10.If you have a backup of your data, restore your data from backup.9.8.4 Scenario 4If the disk is not mirrored, has failed completely, there are no other disks availablein the volume group (the volume group contained only one physical volume or allthe 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 exportvgcommand.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 berequired to reboot the system.5. Make the replacement disk available. If the disk is hot-swappable, you can runcfgmgr; 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 thelogical 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 5If the disk is not mirrored, has failed completely, there are not other disksavailable in the volume group (the volume group contained only one physicalvolume or all physical volumes failed simultaneously), and the volume group 。