AIX useful commands

2012.04.26 23:32

조인상 조회 수:26987

원문 : http://www.ischo.net -- 조인상 // 시스템 엔지니어

Writer : http://www.ischo.net -- ischo // System Engineer in Replubic Of Korea

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

 

원문 : http://www.ischo.net -- 조인상 //시스템 엔지니어

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

 

Useful Disk Drive and Related AIX Commands:


backup Command

The backup command creates copies of your files on a backup medium, such as a magnetic tape or diskette.

Example :

1. To backup file name system.data from current directory to floppy diskette, enter

ls system.data | backup -i


cfgmgr Command

Purpose : Configures devices and optionally installs device software by running the

programs specified in the Configuration Rules object class.

Syntax  : cfgmgr [ -f | -s | -p Phase ] [ -i Device ] [ -l Name ] [ -v ]
Flags   :

    -l Name : Specifies the named device to configure along with its children.

    -v      : Specifies verbose output. The cfgmgr command writes information about what it

is doing to standard output.

Example :

To configure detected devices attached to the SCSI0 adapter, enter:

cfgmgr -vl scsi0

To configure hdisk1, enter:

cfgmgr -vl hdisk1


dd Command

The dd command reads the InFile parameter or standard input, does the specified conversions,

then copies the converted data to the OutFile parameter or standard output.

Command to save data from a boot drive

VGDA(Volume group descriptor area) : (if booted from disk, if not use /dev/hdiskN,

substituting the boot drive number)

dd if=/dev/ipldevice of=/tmp/vgda.orig bs=1024b count=2

BLV(Boot logical volume) : (Make sure lsvg -l rootvg shows type "boot" for LV NAME hd5,

then:)

dd if=/dev/hd5 of=/tmp/path/to/blv.orig bs=1024b


df command

Purpose : Reports information about space on file systems.

Syntax  : df [ [ -P ] | [ -I | -M | -i | -t | -v ] ] [ -k ] [ -s ] [FileSystem ... |

File... ]

Description :

The df command displays information about total space and available space on a file system.

Examples

1.To display information about all mounted file systems, enter: 

df

2.To display available space on the file system in which your current directory resides,

enter:

cd /directory-name

df .



 


diag Command

Purpose: Command line diagnostics

To run microcode download, enter:

diag -c -d  hdisk#   -T"download -F"

To identify physical disks on PCI Raid, enter:

diag -c -d hdisk# -T"identify"

To make a diag trace, enter:

touch /tmp/.DIAG_TRACE

this will create a file called  ".dt.mcode"

To get VPD data for disks attached to RAID:  

disg -cd scraidX -T "identify"


dos commands

AIX supported dos commands

dosdel Command

Purpose : Deletes DOS files.

Syntax  : dosdel [ -v ] [ -D Device ] File ...

-Ddevice : Specifies the name of the DOS device as /dev/fd0 or /dev/fd1. The default

device is /dev/fd0.

-v       : Writes information to standard output about the format of the disk. Use

this flag to verify that a device is a DOS disk.

Examples :

To delete a DOS file on the default device, enter:    

dosdel file.ext

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

dosdir Command

Purpose : Lists the directory for DOS files.

Syntax  : dosdir [ -l [ -e ] ] [ -a ] [ -d ] [ -t ] [ -v ] [ -D Device ] [ File ... |

Directory ... ]

Examples:

To read a directory of the DOS files on /dev/fd0, enter: 

dosdir

To read a directory of the DOS files on /dev/fd1, enter:  

dosdir -D/dev/fd1

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

dosformat Command

Purpose : Formats a DOS diskette.

Syntax  : dosformat [ -V Label ] [-D Device | -4 ]

Examples:

1.To format a 3.5-inch, 1.44M-byte diskette with the volume label "homework," type the

following:

dosformat -V homework

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

dosread Command

Syntax  :  dosread [ -a ] [ -v ] [ -D Device ] File1 [ File2 ]

Description : The dosread command copies the DOS file specified by the File1 variable to

standard output or to the AIX file specified by the File2 variable. If no

pathname is specified for the File2 variable, the DOS file is copied to

the root directory.

Examples

To copy a text file from a DOS diskette to the AIX file system,enter:

dosread -a chap1.doc chap1

This command sequence copies the DOS text file \CHAP1.DOC on default

device /dev/fd0 to the AIX file chap1 in the current directory.

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

doswrite Command

Syntax :  doswrite [ -a ] [ -v ] [ -DDevice ] File1 File2

Description : The doswrite command copies the AIX file specified by the File1 parameter

to the DOS file specified by the File2 parameter. The doswrite command

copies files to a single DOS diskette.

Examples

To copy a text file from the AIX file system to a DOS diskette, enter:

doswrite -a chap1 chap1.doc

This copies the AIX file chap1 in the current directory to the DOS text file \CHAP1.DOC on default device /dev/fd0.


errclear Command

Description : Deletes entries from the error log

Examples :

1.To delete all entries from the error log, enter:

errclear 0

2.To delete all entries in the error log classified as hardware errors, enter:

errclear -d H 0


errlogger Command:

Description : The errlogger command creates an operator error log entry that contains an

operator message up to 230 bytes in length.

Example     : To create an operator message for system drive reconfiguration, enter:

errlogger system drive reconfigured.


errpt Command:

Description

The errpt command generates an error report from entries in an error log.

Flags

-a                  Displays information about errors in the error log file in detailed  

format.

-d ErrorClassList : Limits the error report to certain types of error records specified

by the valid ErrorClassList variables: H (hardware), S (software), 0 (errlogger command messages),  and U (undetermined). The ErrorClassList variable can be separated by , (commas), or enclosed in "" (double quotation marks) and separated by , (commas) or space characters.

-J ErrorLabel     : Includes the error log entries specified by the ErrorLabel variable.

The ErrorLabel variable values can be separated by commas or enclosed in double-quotation marks and separated by commas or blanks. When combined with the -t flag, entries are processed from the error template repository. (Otherwise, entries are processed from the error log repository.)

Examples :

1.To display a complete summary report, enter:

errpt

2. To display a complete detailed report, enter:

errpt -a

3. To display all hardware errors, enter:

errpt -adH

4. To display a detailed report of all errors logged for the error label  DISK_ERR4,

enter:

errpt -a -J DISK_ERR4


File System Commands

chfs : Change File System Size

       chfs -a size=<new size>  <file system>

example: to change /tmp size,  

chfs -a size=32000 /tmp

lspv : Displays information about a physical volume within a volume group
       lspv -p hdiskx

lsvg : Displays information about volume groups(breakdown of LV)
       lsvg -L rootvg

To find where anLBA falls on the disk directory structure:

Find Byte offset :  LBA=  06DD107 (Byte offset= 06DD107*200=DBA20E00 ) Find PP size

[if PP size = 16M, then use 16*1034^2= 0x1000000,  PP size 32M=x2000000]

Divide Byte offset by PP size : 0xDBA20E00 / 0x1000000 = 0xDB [219 decimal]

Find where PP= 219 falls using lspv command, in this example, it is = hd4 = (/)


ftp Command:

Transfers files between a local and a remote host.

get    To download a file

put    To upload a file

Note: use "b" for binary file transfer.

quit   To quit the ftp connection

Use "mget" and "mput" for multiple file transfer.


lquerypv Command

View the content of physical volume(PV)

Syntax :

lquerypv -h /dev/hdiskN  hex_start  hex-length

Example :

lquerypv -h /dev/hdisk1 0 1000

displays the first 1000 Bytes stored on physical disk "hdisk1".

Note : Byte 1000 has drive DEFECT info lquerypv -h /dev/hdisk1 1000


ls Command:

Description

The ls command writes to standard output the contents of each specified Directory parameter or the name of each specified File parameter, along with any other information you ask for with the flags. If you do not specify a File or Directory parameter, the ls command displays the contents of the current directory.

To copy error log to a diskette, enter:

ls /var/adm/ras/errlog | backup -ivp

To copy microcode to a diskette, enter:

ls /etc/microcode/file_name |backup -ivq

To copy error log to a tape, enter:

ls /var/adm/ras/errlog | backup if /dev/rmtX

To create a diskette of microcode download, enter:

ls /etc/microcode/file_name | backup -ivq



lsattr Command

Purpose : Displays attribute characteristics and possible values of attributes for devices

in the system.

Syntax

lsattr { -D [ -O ] | -E [ -O ] | -F Format } -l Name [ -a Attribute ] ...[ -f File ]

   [ -h ] [ -H ]

Description

The lsattr command displays information about the attributes of a given device or kind of device. If you do not specify the device logical name (-l Name), you must use a combination of one or all of the -c Class, -s Subclass, and -t Type flags to uniquely identify the predefined device.

You must specify one of the following flags with the lsattr command:

-D         Displays default values.
-E         Displays effective values (valid only for customized devices

specified with the -l flag).

-F Format  Specifies the user-defined format.

-R         Displays the range of legal values.

Examples

    1.To list the current attribute values for the SCSI adapter scsi0, enter:

lsattr -l scsi0 -E


lscfg Command:

Displays configuration, diagnostic, and vital product data (VPD) information about the system.  Use the lscfg command to display vital product data (VPD) such as part numbers,

serial numbers, and engineering change

Usage   : lscfg [ -rv ] | [ [ -r ] | [ -v ] [ -l Name ] ]

Example :

1. To display the VPD for all DASD devices, enter:

lscfg -vl hdisk*

The system displays information for the DASD(hdisk) devices , as follows:

DEVICE  LOCATION            DESCRIPTION

hdisk0 04-B0-00-2,0  2.2 GB SCSI Disk Drive

Manufacturer................IBMRISC

Machine Type and Model......DFHSS2F

Part Number.................74G6976

ROS Level and ID............34323432

Serial Number...............68C26279

EC Level....................486509

FRU Number..................74G6996

Device Specific.(Z0)........000002029F00001E

Device Specific.(Z1)........RAMST04B

Device Specific.(Z2)........09RI

Device Specific.(Z3)........96221

Device Specific.(Z4)........0002

Device Specific.(Z5)........22

Device Specific.(Z6)........E28308

2. To get a hard copy of hdisk configuration, enter:

lscfg -vl hdisk* > /dev/lpo

3. To display VPD for all devices, enter:

lscfg -vp

4. To display system FW, enter:

lscfg -vp |grep alterable


lsdev Command

Purpose     : Displays devices in the system and their characteristics.

Description : The lsdev command displays information about devices in the Device

Configuration database. You can display information about all devices in the Customized Devices object class using the -C flag.

-C          Lists information about a device that is in the Customized Devices object class.

The default information displayed is name, status, location, and description. This flag cannot be used with the -P flag.

-c Class    Specifies a device class name. This flag can be used to restrict output to

devices in a specified class.

Example : To list the disks that are in the Customized Devices object class, enter:  

lsdev -Cc disk

  The system displays a message similar to the following:

  hdisk0 Available 04-B0-00-2,0 2.2 GB SCSI Disk Drive

lsdev -C |grep scsi    to find scsi#


lspv Command:

Displays information about a logical volume.

Display Physical Volume of hard disk drive

Usage   : lspv <hdisk#>;

Example : <lspv hdisk0> will display physical volume of hard disk 0


lslpp Command:

Lists software products

Usage :  lslpp {-d|-f|-h|-i|-L|-l|-p} [-B | -I] [-acJq] [-O{[r][s][u]}] [fileset ... |

ptf_id ... | all]        OR

lslpp -w [-cq] [-O{[r][s][u]}] [ filename ... | all ]

Example : To display software(device drivers, diags, etc) for SCSI devices, type

lslpp -l *.scsi.*


lsresourc Command

Displays system resources for available devices in the system.

Example :

1.To list bus attributes for the token ring device, enter:

lsresource -l tok0

The system displays a message similar to the following:

TYPE   DEVICE         ATTRIBUTE       S G CURRENT VALUE

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

M     tok0            dma_bus_mem         0x003b2000 - 0x003f1fff

O     tok0            bus_io_addr         0x000086a0 - 0x000086af

N     tok0            bus_intr_lvl                  3

A     tok0            dma_lvl                       7


lsvg Command

Purpose :  Displays information about volume groups.

Syntax  :  lsvg [ -L ] [ -o ] | [ -n DescriptorPhysicalVolume ] | [ -i ] [ -l | -M | -p ]

VolumeGroup ...

Example :

1. To display the names of all active volume groups, enter:

lsvg -o

2. To display the names of all volume groups within the system, enter:

lsvg

3. To display information about volume group vg02, enter:

lsvg vg02


mksysb Command

Purpose : Creates an installable image of the root volume group either in a file or onto a

bootable tape.

Syntax : mksysb [ -b Number ] [ -e ] [ -p ] [ -v ] [ -X ] [ -i | -m ] Device | File


odmget command:

Retrieves objects from the specified object classes into an odmadd input file.

Syntax   : odmget [ -q Criteria ] ObjectClass ...

Examples :

odmget PdDv

odmget -q class=disk PdDv

odmget -q "name=hdisk1" CuAt

odmget -q "name=hdisk0" CuDv


restore Command

Description : The restore command reads archives created by the backup command and extracts

the files stored on them. The diskette device, /dev/rfd0, is the default media for the restore command.

Example:

1. To list the names of files in either a file-name or file-system archive on the

diskette device /dev/rfd0, enter:

restore -Tq

2. To restore all files in diskette device, enter:

restore

3. To restore a specific file, enter:

restore -xv  system.data

This command extracts the file system.data into the current directory from the

diskette device


rmdev Command

Syntax       : rmdev -l Name [ -d | -S ] [ -f File ] [ -h ] [ -q ] [ -R ]

Description  : The rmdev command unconfigures or both unconfigures and undefines the device

specified with the device logical name (the -l Name flag). The default action unconfigures the device while retaining its device definition in the Customized Devices object class.

Flags

-d        Removes the device definition from the Customized Devices object class.

-l Name   Specifies the logical device, indicated by the Name variable, in the

Customized Devices object class.

Examples

1. To unconfigure the hdisk1 device while retaining its device definition in the

Customized Devices object class, enter:

rmdev -l hdisk1

The system displays a message similar to the following : hdisk1 defined

2. To remove the hdisk1 device definition from the Customized Devices object class,

enter:

rmdev -dl hdisk1

The system displays a message similar to the following : hdisk1 deleted

3. To remove "scsi1" and all attached devices to scsi1 adapter:

rmdev -l scsi1 -dR


set keyboard:

View previous commands

enter

            set -0 vi

then     <Esc> k     to view previous commands


Other Commands

Open DASD : To open DASD device, enter   </dev/hdisk2

To see Current Directory, type       pwd

Uname     : To get system model      uname -M

 

 

 

 

번호 제목 글쓴이 날짜 조회 수
공지 [공지] 게시자료 열람자유. 불펌금지입니다. 조인상 2010.12.07 109879
211 SAS RAID controller for AIX [1] file ischo 2017.02.04 17815
210 AIX 환경에서 TCP dump 뜨기 [1] ischo 2014.12.05 29611
209 AIX에서 시스템의 hostname 변경하기 ischo 2013.04.30 45552
208 kill 과 함께 쓰이는 SIGNAL NUMBER 들 ischo 2013.02.16 29101
207 AIX에서 process 당 thead 개수 (maximum number of thread per process) ischo 2013.02.06 35627
206 AIX 6.1에 Apache 설치하기 ischo 2013.02.01 49091
205 AIX 시스템상의 core수 확인하기 ischo 2013.01.10 102407
204 named 1분 간격으로 검사하여 살리는 스크립트 [1] ischo 2012.12.26 28474
203 AIX 튜닝포인트 - CPU,MEM,VG + FAQ [1] ischo 2012.11.20 42077
202 lsof 설치 없이 해당 포트를 열고 있는 프로세스 확인하는 법 ischo 2012.10.17 58572
201 p시리즈 장비 OP패널에서 강제 shutdown 방법 조인상 2012.10.13 29489
200 [IBM] x시리즈 M3,M4 블레이드센터 제원 조인상 2012.10.06 25955
199 IBM System x Sales Tech and Sales School 조인상 2012.08.09 27600
198 Power6 System Reference Code 조인상 2012.08.09 26575
197 IBM x3650 M3 Service Guide file 조인상 2012.08.04 28640
196 펌웨어 업그레이드 for old p5 series Servers(SF240-417) file ischo 2012.07.26 28333
195 디버그툴 dbx 사용법 file 조인상 2012.07.26 34107
194 IBM AIX Version 6.1 Differences Guide file 조인상 2012.07.26 44316
193 IBM AIX Version 7.1 Differences Guide file 조인상 2012.07.26 34904
192 p시리즈 펌웨어 업데이트 방법 조인상 2012.07.20 35249
서버에 요청 중입니다. 잠시만 기다려 주십시오...