- 论坛徽章:
- 0
|
Level: Intermediate\r\n\r\nShiv Dutta, Senior Software Engineer, IBM\r\n\r\n\r\n06 May 2003\r\nUpdated 24 Oct 2006\r\n\r\nDo you ever feel you wish you could answer some of your own questions when you work with AIX® and your System p™ server? Do you ever feel you could save time by not having to call on the support professionals all the time? Well, wish no more. Shiv Dutta discusses some of the AIX commands that answer those questions and tells you how to enlarge the list of such answers.\r\nIntroduction\r\n\r\nAs you know, AIX® has a vast array of commands that enable you to do a multitude of tasks. Depending on what you need to accomplish, you use only a certain subset of these commands. These subsets differ from user to user and from need to need. However, there are a few core commands that you commonly use. You need these commands either to answer your own questions or to provide answers to the queries of the support professionals.\r\n\r\nIn this article, I\'ll discuss some of these core commands. The intent is to provide a list that you can use as a ready reference. While the behavior of these commands should be identical in all releases of AIX, they have been only tested under AIX 5.3.\r\n\r\nNote:\r\nThe bootinfo command discussed in the following paragraphs is NOT a user-level command and is NOT supported in AIX 4.2 or later.\r\n\r\n\r\n \r\n\r\n Back to top \r\n \r\n\r\n\r\n\r\nCommands\r\n\r\nKernel\r\n\r\nHow would I know if I am running a 32-bit kernel or 64-bit kernel? \r\n\r\nTo display if the kernel is 32-bit enabled or 64-bit enabled, type:\r\n\r\nbootinfo -K \r\n\r\n\r\nHow do I know if I am running a uniprocessor kernel or a multiprocessor kernel? \r\n\r\n/unix is a symbolic link to the booted kernel. To find out what kernel mode is running, enter ls -l /unix and see what file /unix it links to. The following are the three possible outputs from the ls -l /unix command and their corresponding kernels: \r\n\r\n/unix -> /usr/lib/boot/unix_up # 32 bit uniprocessor kernel \r\n/unix -> /usr/lib/boot/unix_mp # 32 bit multiprocessor kernel\r\n/unix -> /usr/lib/boot/unix_64 # 64 bit multiprocessor kernel \r\n \r\n\r\n\r\nNote:\r\nAIX 5L Version 5.3 does not support a uniprocessor kernel.\r\n\r\nHow can I change from one kernel mode to another? \r\n\r\nDuring the installation process, one of the kernels, appropriate for the AIX version and the hardware in operation, is enabled by default. Let us use the method from the previous question and assume the 32-bit kernel is enabled. Let us also assume that you want to boot it up in the 64-bit kernel mode. This can be done by executing the following commands in sequence: \r\n\r\nln -sf /usr/lib/boot/unix_64 /unix\r\nln -sf /usr/lib/boot/unix_64 /usr/lib/boot/unix\r\n\r\nbosboot -ad /dev/hdiskxx\r\nshutdown -r\r\n \r\n\r\n\r\nThe /dev/hdiskxx directory is where the boot logical volume /dev/hd5 is located. To find out what xx is in hdiskxx, run the following command: \r\n\r\n lslv -m hd5\r\n \r\n\r\n\r\nNote:\r\nIn AIX 5.2, the 32-bit kernel is installed by default. In AIX 5.3, the 64-bit kernel is installed on 64-bit hardware and the 32-bit kernel is installed on 32-bit hardware by default.\r\n\r\nHardware\r\n\r\nHow would I know if my machine is capable of running AIX 5L Version 5.3? \r\n\r\nAIX 5L Version 5.3 runs on all currently supported CHRP (Common Hardware Reference Platform)-based POWER hardware.\r\n\r\nHow would I know if my machine is CHRP-based? \r\n\r\nRun the prtconf command. If it\'s a CHRP machine, the string chrp appears on the Model Architecture line.\r\n\r\nHow would I know if my System p machine (hardware) is 32-bit or 64-bit? \r\n\r\nTo display if the hardware is 32-bit or 64-bit, type:\r\n\r\nbootinfo -y \r\n\r\n\r\nHow much real memory does my machine have? \r\n\r\nTo display real memory in kilobytes (KB), type one of the following:\r\n\r\nbootinfo -r \r\n\r\n\r\nlsattr -El sys0 -a realmem \r\n\r\n\r\n\r\nCan my machine run the 64-bit kernel? \r\n\r\n64-bit hardware is required to run the 64-bit kernel. \r\n\r\nWhat are the values of attributes for devices in my system? \r\n\r\nTo list the current values of the attributes for the tape device, rmt0, type:\r\n\r\nlsattr -l rmt0 -E \r\n\r\n\r\nTo list the default values of the attributes for the tape device, rmt0, type:\r\n\r\nlsattr -l rmt0 -D \r\n\r\n\r\nTo list the possible values of the login attribute for the TTY device, tty0, type:\r\n\r\nlsattr -l tty0 -a login -R \r\n\r\n\r\nTo display system level attributes, type:\r\n\r\nlsattr -E -l sys0 \r\n\r\n\r\nHow many processors does my system have? \r\n\r\nTo display the number of processors on your system, type:\r\n\r\nlscfg | grep proc \r\n\r\n\r\nHow many hard disks does my system have and which ones are in use? \r\n\r\nTo display the number of hard disks on your system, type:\r\n\r\nlspv \r\n\r\n\r\nHow do I list information about a specific physical volume?\r\n\r\nTo find details about hdisk1, for example, run the following command: lspv hdisk1 \r\n \r\n\r\n\r\n\r\nHow do I get a detailed configuration of my system? \r\n\r\nType the following:\r\n\r\nlscfg \r\n\r\n\r\nThe following options provide specific information: -p Displays platform-specific device information. The flag is applicable to AIX 4.2.1 or later. \r\n-v Displays the VPD (Vital Product Database) found in the customized VPD object class. \r\n\r\n\r\nFor example, to display details about the tape drive, rmt0, type: \r\n\r\nlscfg -vl rmt0 \r\n\r\n\r\nYou can obtain very similar information by running the prtconf command.\r\n\r\nHow do I find out the chip type, system name, node name, model number, and so forth? \r\n\r\nThe uname command provides details about your system. uname -p Displays the chip type of the system. For example, PowerPC. \r\nuname -r Displays the release number of the operating system. \r\nuname -s Displays the system name. For example, AIX. \r\nuname -n Displays the name of the node. \r\nuname -a Displays the system name, nodename, version, machine ID. \r\nuname -M Displays the system model name. For example, IBM, 9114-275. \r\nuname -v Displays the operating system version. \r\nuname -m Displays the machine ID number of the hardware running the system. \r\nuname -u Displays the system ID number. \r\n\r\n\r\nAIX\r\n\r\nWhat version, release, and maintenance level of AIX is running on my system? \r\n\r\nType one of the following: \r\n\r\noslevel -r \r\n\r\n\r\nlslpp -h bos.rte \r\n\r\n\r\n\r\nHow can I determine which fileset updates are missing from a particular AIX level?\r\n\r\nTo determine which fileset updates are missing from 5300-04, for example, run the following command:\r\n\r\noslevel -rl 5300-04 \r\n\r\n\r\nWhat SP (Service Pack) is installed on my system?\r\n\r\nTo see which SP is currently installed on the system, run the oslevel -s command. Sample output for an AIX 5L Version 5.3 system, with TL4, and SP2 installed would be:\r\n\r\noslevel –s\r\n5300-04-02\r\n \r\n\r\n\r\nIs a CSP (Concluding Service Pack) installed on my system?\r\n\r\nTo see if a CSP is currently installed on the system, run the oslevel -s command. Sample output for an AIX 5L Version 5.3 system, with TL3, and CSP installed would be:\r\n\r\noslevel –s\r\n5300-03-CSP\r\n \r\n\r\n\r\nHow do I create a file system?\r\n\r\nThe following command will create, within volume group testvg, a jfs file system of 10MB with mounting point /fs1:\r\n\r\ncrfs -v jfs -g testvg -a size=10M -m /fs1 \r\n \r\n\r\n\r\nThe following command will create, within volume group testvg, a jfs2 file system of 10MB with mounting point /fs2 and having read only permissions:\r\n\r\ncrfs -v jfs2 -g testvg -a size=10M -p ro -m /fs2 \r\n \r\n\r\n\r\nHow do I change the size of a file system? \r\n\r\nTo increase the /usr file system size by 1000000 512-byte blocks, type:\r\n\r\nchfs -a size=+1000000 /usr \r\n\r\n\r\nNote:\r\nIn AIX 5.3, the size of a JFS2 file system can be shrunk as well.\r\n\r\nHow do I mount a CD? \r\n\r\nType the following: \r\n\r\nmount -V cdrfs -o ro /dev/cd0 /cdrom \r\n\r\n\r\nHow do I mount a file system?\r\n\r\nThe following command will mount file system /dev/fslv02 on the /test directory:\r\n\r\nmount /dev/fslv02 /test \r\n \r\n\r\n\r\nHow do I mount all default file systems (all standard file systems in the /etc/filesystems file marked by the mount=true attribute)?\r\n\r\nThe following command will mount all such file systems:\r\n\r\nmount {-a|all}\r\n \r\n\r\n\r\nHow do I unmount a file system?\r\n\r\nType the following command to unmount /test file system:\r\n\r\numount /test\r\n \r\n\r\n\r\nHow do I display mounted file systems?\r\n\r\nType the following command to display information about all currently mounted file systems:\r\n\r\nmount\r\n \r\n\r\n\r\nHow do I remove a file system?\r\n\r\nType the following command to remove the /test file system:\r\n\r\nrmfs /test\r\n \r\n\r\n\r\nHow can I defragment a file system?\r\n\r\nThe defragfs command can be used to improve or report the status of contiguous space within a file system. For example, to defragment the file system /home, use the following command:\r\n\r\ndefragfs /home\r\n \r\n\r\n\r\nWhich fileset contains a particular binary? \r\n\r\nTo show bos.acct contains /usr/bin/vmstat, type:\r\n\r\nlslpp -w /usr/bin/vmstat \r\n\r\n\r\nOr to show bos.perf.tools contains /usr/bin/svmon, type:\r\n\r\nwhich_fileset svmon \r\n\r\n\r\nHow do I display information about installed filesets on my system?\r\n\r\nType the following:\r\n\r\nlslpp -l \r\n \r\n\r\n\r\nHow do I determine if all filesets of maintenance levels are installed on my system? \r\n\r\nType the following:\r\n\r\ninstfix -i | grep ML \r\n\r\n\r\nHow do I determine if a fix is installed on my system? \r\n\r\nTo determine if IY24043 is installed, type:\r\n\r\ninstfix -ik IY24043 \r\n\r\n\r\nHow do I install an individual fix by APAR?\r\n\r\nTo install APAR IY73748 from /dev/cd0, for example, enter the command:\r\n\r\ninstfix -k IY73748 -d /dev/cd0 \r\n \r\n\r\n\r\nHow do I verify if filesets have required prerequisites and are completely installed? \r\n\r\nTo show which filesets need to be installed or corrected, type:\r\n\r\nlppchk -v \r\n\r\n\r\nHow do I get a dump of the header of the loader section and the symbol entries in symbolic representation? \r\n\r\nType the following:\r\n\r\ndump -Htv \r\n\r\n\r\nHow do I determine the amount of paging space allocated and in use? \r\n\r\nType the following:\r\n\r\nlsps -a \r\n\r\n\r\nHow do I increase a paging space?\r\n\r\nYou can use the chps -s command to dynamically increase the size of a paging space. For example, if you want to increase the size of hd6 with 3 logical partitions, you issue the following command:\r\n\r\nchps -s 3 hd6 \r\n \r\n\r\n\r\nHow do I reduce a paging space?\r\n\r\nYou can use the chps -d command to dynamically reduce the size of a paging space. For example, if you want to decrease the size of hd6 with four logical partitions, you issue the following command:\r\n\r\nchps -d 4 hd6 \r\n \r\n\r\n\r\nHow would I know if my system is capable of using Simultaneous Multi-threading (SMT)? \r\n\r\nYour system is capable of SMT if it\'s a POWER5-based system running AIX 5L Version 5.3.\r\n\r\nHow would I know if SMT is enabled for my system? \r\n\r\nIf you run the smtctl command without any options, it tells you if it\'s enabled or not.\r\n\r\nIs SMT supported for the 32-bit kernel? \r\n\r\nYes, SMT is supported for both 32-bit and 64-bit kernel.\r\n\r\nHow do I enable or disable SMT? \r\n\r\nYou can enable or disable SMT by running the smtctl command. The following is the syntax: smtctl [ -m off | on [ -w boot | now]] \r\n\r\n\r\n\r\nThe following options are available:\r\n\r\n-m off Sets SMT mode to disabled. \r\n-m on Sets SMT mode to enabled. \r\n-w boot Makes the SMT mode change effective on next and subsequent reboots if you run the bosboot command before the next system reboot. \r\n-w now Makes the SMT mode change immediately but will not persist across reboot. \r\n\r\nIf neither the -w boot or the -w now options are specified, then the mode change is made immediately. It persists across subsequent reboots if you run the bosboot command before the next system reboot. \r\n\r\nHow do I get partition-specific information and statistics? \r\n\r\nThe lparstat command provides a report of partition information and utilization statistics. This command also provides a display of Hypervisor information.\r\n\r\nVolume groups and logical volumes\r\n\r\nHow do I know if my volume group is normal, big, or scalable? \r\n\r\nRun the lsvg command on the volume group and look at the value for MAX PVs. The value is 32 for normal, 128 for big, and 1024 for scalable volume group.\r\n\r\nHow to create a volume group? \r\n\r\nUse the following command, where s partition_size sets the number of megabytes (MB) in each physical partition where the partition_size is expressed in units of MB from 1 through 1024. (It\'s 1 through 131072 for AIX 5.3.) The partition_size variable must be equal to a power of 2 (for example: 1, 2, 4, 8). The default value for standard and big volume groups is the lowest value to remain within the limitation of 1016 physical partitions per physical volume. The default value for scalable volume groups is the lowest value to accommodate 2040 physical partitions per physical volume.\r\n\r\nmkvg -y name_of_volume_group -s partition_size list_of_hard_disks\r\n \r\n\r\n\r\nHow can I change the characteristics of a volume group? \r\n\r\nYou use the following command to change the characteristics of a volume group:\r\n\r\nchvg\r\n \r\n\r\n\r\nHow do I create a logical volume? \r\n\r\nType the following:\r\n\r\nmklv -y name_of_logical_volume name_of_volume_group number_of_partition\r\n \r\n\r\n\r\nHow do I increase the size of a logical volume?\r\n\r\nTo increase the size of the logical volume represented by the lv05 directory by three logical partitions, for example, type:\r\n\r\nextendlv lv05 3\r\n \r\n\r\n\r\nHow do I display all logical volumes that are part of a volume group (for example, rootvg)?\r\n\r\nYou can display all logical volumes that are part of rootvg by typing the following command:\r\n\r\nlsvg -l rootvg\r\n \r\n\r\n\r\nHow do I list information about logical volumes?\r\n\r\nRun the following command to display information about the logical volume lv1:\r\n\r\nlslv lv1\r\n \r\n\r\n\r\nHow do I remove a logical volume?\r\n\r\nYou can remove the logical volume lv7 by running the following command:\r\n\r\nrmlv lv7\r\n \r\n\r\n\r\nThe rmlv command removes only the logical volume, but does not remove other entities, such as file systems or paging spaces that were using the logical volume.\r\n\r\nHow do I mirror a logical volume?\r\n\r\nmklvcopy LogicalVolumeName Numberofcopies \r\nsyncvg VolumeGroupName \r\n\r\nHow do I remove a copy of a logical volume?\r\n\r\nYou can use the rmlvcopy command to remove copies of logical partitions of a logical volume. To reduce the number of copies of each logical partition belonging to logical volume testlv, enter:\r\n\r\nrmlvcopy testlv 2\r\n \r\n\r\n\r\nEach logical partition in the logical volume now has at most two physical partitions.\r\n\r\nQueries about volume groups \r\n\r\nTo show volume groups in the system, type: \r\n\r\nlsvg \r\n\r\n\r\nTo show all the characteristics of rootvg, type: \r\n\r\nlsvg rootvg \r\n\r\n\r\nTo show disks used by rootvg, type: \r\n\r\nlsvg -p rootvg \r\n\r\n\r\nHow to add a disk to a volume group? \r\n\r\nType the following:\r\n\r\nextendvg VolumeGroupName hdisk0 hdisk1 ... hdiskn \r\n \r\n\r\n\r\nHow do I find out what the maximum supported logical track group (LTG) size of my hard disk? \r\n\r\nYou can use the lquerypv command with the -M flag. The output gives the LTG size in KB. For instance, the LTG size for hdisk0 in the following example is 256 KB.\r\n\r\n/usr/sbin/lquerypv -M hdisk0\r\n256\r\n \r\n\r\n\r\nYou can also run the lspv command on the hard disk and look at the value for MAX REQUEST.\r\n\r\nWhat does syncvg command do?\r\n\r\nThe syncvg command is used to synchronize stale physical partitions. It accepts names of logical volumes, physical volumes, or volume groups as parameters.\r\n\r\nFor example, to synchronize the physical partitions located on physical volumes hdisk6 and hdisk7, use:\r\n\r\nsyncvg -p hdisk4 hdisk5 \r\n \r\n\r\n\r\nTo synchronize all physical partitions from volume group testvg, use:\r\n\r\nsyncvg -v testvg \r\n \r\n\r\n\r\nHow do I replace a disk? \r\n\r\nextendvg VolumeGroupName hdisk_new \r\nmigratepv hdisk_bad hdisk_new \r\nreducevg -d VolumeGroupName hdisk_bad \r\nHow can I clone (make a copy of ) the rootvg? \r\n\r\nYou can run the alt_disk_copy command to copy the current rootvg to an alternate disk. The following example shows how to clone the rootvg to hdisk1.\r\n\r\nalt_disk_copy -d hdisk1\r\n \r\n\r\n\r\nNetwork\r\n\r\nHow can I display or set values for network parameters? \r\n\r\nThe no command sets or displays current or next boot values for network tuning parameters.\r\n\r\nHow do I get the IP address of my machine?\r\n\r\nType one of the following:\r\n\r\nifconfig -a\r\n\r\nhost Fully_Qualified_Host_Name\r\n \r\n\r\n\r\nFor example, type host cyclop.austin.ibm.com.\r\n\r\nHow do I identify the network interfaces on my server?\r\n\r\nEither of the following two commands will display the network interfaces:\r\n\r\nlsdev -Cc if\r\n \r\n\r\nifconfig -a\r\n \r\n\r\n\r\nTo get information about one specific network interface, for example, tr0, run the command:\r\n\r\nifconfig tr0\r\n \r\n\r\n\r\nHow do I activate a network interface?\r\n\r\nTo activate the network interface tr0, run the command:\r\n\r\nifconfig tr0 up\r\n \r\n\r\n\r\nHow do I deactivate a network interface?\r\n\r\nFor example, to deactivate the network interface tr0, run the command:\r\n\r\nifconfig tr0 down\n\n[ 本帖最后由 lingfeng_e6 于 2007-6-5 11:53 编辑 ] |
|