chdev 명령어 (AIX 5.3·6.1)

핵심 정리

  • 장치 속성을 바꿉니다. chdev -l 장치 -a 속성=값. 여러 속성은 -a를 여러 번 주거나 -a 'a=1 b=2'처럼 따옴표로 묶습니다.
  • 플래그 없이 쓰면 장치와 ODM을 함께 바꿉니다. 장치가 사용 중이라 바꿀 수 없으면 -P로 ODM만 바꾸고 다음 부팅부터 적용합니다(디스크 queue_depth, FC 어댑터 속성 등).
  • -T는 ODM은 두고 장치만 임시로, -U(6.1)는 Available 상태를 유지한 채 바꿉니다. 지원 여부는 장치·속성마다 다릅니다.
  • 자주 쓰는 예: chdev -l sys0 -a maxuproc=4096, chdev -l hdisk2 -a reserve_policy=no_reserve, chdev -l fscsi0 -a dyntrk=yes -a fc_err_recov=fast_fail -P, chdev -l en0 -a netaddr=... -a netmask=..., chdev -l inet0 -a hostname=....
  • 중간에 멈추면 ODM이 망가질 수 있어 인터럽트가 되지 않습니다.
항목 내용
버전 AIX 5.3, AIX 6.1 (6.1에서 -U(Available 상태에서 바꾸기)와 -g(잠긴 장치에 강제로)가 더해짐)
원문 IBM Commands Reference — 5.3 Volume 1, 6.1 Volume 1
파일 /usr/sbin/chdev
관련 명령어 lsattr, lsdev, mkdev, rmdev, lsconn, smitty chgsys

목적

장치의 특성을 바꿉니다.

영어 원문

Changes the characteristics of a device.

구문

text
chdev -l Name [ -a Attribute=Value ... ] [ -f File ] [ -h ] [ -p ParentName ] [ -P | -T ] [ -U ] [ -q ]
      [ -w ConnectionLocation ] [ -g ]

-U와 -g는 6.1 구문에만 있습니다.

설명

chdev 명령은 -l Name으로 지정한 논리 이름의 장치 특성을 바꿉니다. 장치는 Defined, Stopped, Available 상태 어느 것이어도 되지만, Available 상태에서는 허락되지 않는 변경도 있습니다. 플래그는 명령줄에서 주거나 -f File로 파일에서 읽습니다.

-P, -U, -T를 주지 않으면 장치에 변경을 적용하고 데이터베이스도 고칩니다. -P를 주면 데이터베이스만 고치고 장치는 그대로 둡니다. 장치가 사용 중이라 바꿀 수 없을 때 쓸모 있으며, 데이터베이스에 넣은 변경은 시스템을 다시 시작할 때 장치에 적용됩니다.

(6.1) -U를 주면 데이터베이스를 고치고, 장치를 Available 상태로 둔 채 바꿉니다. Available 상태에서 바꿀 수 있는 속성에만 쓸 수 있습니다. 이때 데이터베이스에는 -U와 함께 준 속성을 넣고, 장치는 Available 상태에서 바꿀 수 있는 모든 속성의 현재 값으로 바뀝니다. 장치가 이런 속성을 지원하는지는 lsattr로 봅니다.

-T는 데이터베이스에 반영하지 않고 장치만 임시로 바꿉니다. 시스템을 다시 시작하면 데이터베이스에 적힌 특성으로 돌아갑니다. 모든 장치가 -P, -U, -T를 지원하지는 않습니다. 장치가 Defined 상태면 변경은 데이터베이스에만 적용됩니다.

주의: 구성 데이터베이스를 보호하려고 chdev는 인터럽트되지 않습니다. 끝나기 전에 멈추면 데이터베이스가 망가질 수 있습니다.

Web-based System Manager(wsm)의 Devices 응용 프로그램이나 SMIT 빠른 경로 smit chdev로도 장치 특성을 바꿀 수 있습니다.

영어 원문

The chdev command changes the characteristics of the specified device with the given device logical name that is specified with the -l Name flag. The device can be in the Defined, Stopped, or Available state. Some changes may not be allowed when the device is in the Available state. When changing the device characteristics, you can supply the flags either on the command line or in the specified -f File flag.

When the -P, -U, and -T flags are not specified, the chdev command applies the changes to the device and updates the database to reflect the changes. If the -P flag is specified, only the database is updated to reflect the changes, and the device is left unchanged. This is useful in cases where a device cannot be changed because it is in use. In cases where the device is in use, the changes can be made to the database with the -P flag, and the changes will be applied to the device when the system is restarted.

If the –U flag is specified, the database is updated to reflect the changes, and the device is changed while the device remains in the Available state. This option is applicable only to attributes that can be updated while the device is in the Available state. When the –U flag is specified the database is updated with the attributes that are provided with the –U flag and the device is changed to the current values of all attributes that can be updated while the device is in the Available state. See the lsattr command to determine whether the device supports this attribute type.

The -T flag is used to make a temporary change in the device without the change being reflected in the database.The device temporary reverts to the characteristics that are described in the database when the system is restarted. All devices do not support the -P, -U, and -T flags. If a device is in the Defined state, changes are applied only to the database.

Attention: To protect the Configuration database, the chdev command is not interruptible. Stopping this command before it is complete could result in a corrupted database.

You can use the Devices application in Web-based System Manager (wsm) or the System Management Interface Tool (SMIT) smit chdev fast path to change device characteristics.

플래그

플래그 설명
-a Attribute=Value 바꿀 속성-값 쌍. -a 하나에 쌍 하나나 여럿을 줄 수 있으며, 여럿이면 따옴표로 감싸고 공백으로 나눕니다. 예: -a Attribute=Value, -a 'Attribute1=Value1 Attribute2=Value2'
-f File 필요한 플래그를 File에서 읽습니다.
-g 잠긴 장치에도 변경을 강제로 합니다. 6.1부터
-h 사용법을 보여 줍니다.
-l Name 특성을 바꿀 장치의 논리 이름(사용자 정의 장치).
-P 장치는 바꾸지 않고 사용자 정의 장치 객체 클래스의 특성을 영구로 바꿉니다. 사용할 수 없게 만들 수도 없고 Available 상태에서 바꿀 수도 없는 장치에 쓸모 있으며, 다음 부팅 때 장치에 적용됩니다. -T와 함께 쓸 수 없고, 모든 장치가 지원하지는 않습니다.
-p ParentName 장치의 새 부모 장치 논리 이름. 부모를 바꿀 때만 씁니다. 모든 장치가 지원하지는 않습니다.
-q 표준 출력과 표준 오류의 메시지를 막습니다.
-T 이번 시스템 시작 동안만, 사용자 정의 장치 객체 클래스는 바꾸지 않고 장치 특성을 임시로 바꿉니다. -P와 함께 쓸 수 없고, 모든 장치가 지원하지는 않습니다.
-U 장치를 Available 상태로 둔 채 특성을 바꿉니다. -P, -T와 함께 쓸 수 없고, 모든 장치·속성이 지원하지는 않습니다. 6.1부터
-w ConnectionLocation 부모에서 장치의 새 연결 위치. 연결 위치를 바꿀 때만 씁니다. 모든 장치가 지원하지는 않습니다.
영어 원문
  • -a Attribute=Value — Specifies the device attribute-value pairs used for changing specific attribute values. The Attribute=Value parameter can use one attribute value pair or multiple attribute value pairs for one -a flag. If you use an -a flag with multiple attribute value pairs, the list of pairs must be enclosed in quotes with spaces between the pairs. For example, entering -a Attribute=Value lists one attribute value pair per flag, while entering -a 'Attribute1=Value1 Attribute2=Value2' lists more than one attribute value pair.
  • -f File — Reads the necessary flags from the named File parameter.
  • -g — Forces the change operation to take place on a locked device.
  • -h — Displays the command usage message.
  • -l Name — Specifies the device logical name in the Customized Devices object class whose characteristics are to be changed.
  • -P — Changes the device's characteristics permanently in the Customized Devices object class without actually changing the device. This is useful for devices that cannot be made unavailable and cannot be changed while in the available state. The change is made to the database, and the changes are applied to the device when the system is rebooted. This flag cannot be used with the -T flag. Not all devices support the -P flag.
  • -p ParentName — Specifies the new device logical name of the parent device in the Customized Devices object class. Use this flag only when changing the parent of the device. Not all devices support the -p flag.
  • -q — Suppresses the command output messages from standard output and standard error.
  • -T — Changes the characteristics of the device temporarily without changing the Customized Devices object class for the current start of the system. This flag cannot be used with the -P flag. Not all devices support the -T flag.
  • -U — Changes the characteristics of the device while allowing the device to remain in the Available state. This flag cannot be used with the -P or -T flag. Not all devices and attributes support the -U flag.
  • -w ConnectionLocation — Specifies the new connection location of the device on the parent. Use this flag only when changing the connection location of the device. Not all devices support the -w flag.

보안

접근 제어: root와 security 그룹 구성원만 이 명령의 실행(x) 권한을 가져야 합니다.

감사 이벤트: DEV_Change(cfgmgr가 부르는 메서드의 매개변수).

RBAC 사용자와 Trusted AIX 사용자는 주의하세요. 이 명령은 특권 작업을 할 수 있으며, 특권 작업은 특권 사용자만 할 수 있습니다. 특권과 권한 목록은 lssecattr 명령이나 getcmdattr 하위 명령으로 봅니다(6.1).

영어 원문

Access Control

Only the root user and members of the security group should have execute (x) access to this command.

Auditing Events

Auditing Event Information DEV_Change Parameters to the method the cfgmgr command calls.

Attention RBAC users and Trusted AIX users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand.

예제

명령 하는 일
chdev -l rmt0 -a ret=no 4mm SCSI 테이프 rmt0가 테이프를 넣거나 전원을 켤 때마다 처음-끝-처음으로 감는 것(retension)을 끔. rmt0 changed가 나옴
chdev -l tok0 -f changattr 토큰 링 어댑터 tok0의 속성을 파일 changattr에 적힌 값으로 바꿈
chdev -l scsi0 -a id=6 -P 디스크가 붙어 있어 사용할 수 없게 만들 수 없는 scsi0의 SCSI ID를 6으로. 적용하려면 시스템을 다시 시작
chdev -l tty11 -p sa5 -w 0 Defined 상태의 tty11을 직렬 어댑터 sa5의 포트 0으로 옮김
chdev -l sys0 -a maxuproc=100 사용자당 최대 프로세스 수를 100으로
chdev -l en2 -a delalias4=10.3.4.3 en2의 ODM 항목 alias4=10.3.4.3을 지움
chdev -l en3 -a delalias6=fe80::20b4:40ff:fe00:f016/64 en3의 ODM 항목 alias6=...을 지움
chdev -l fscsix -a dyntrk=yes FC 어댑터의 동적 추적(dynamic tracking)을 켬
chdev -l fscsix -a fc_err_recov=fast_fail FC 어댑터의 fast_fail을 켬

자주 쓰는 형태:

bash
chdev -l sys0 -a maxuproc=4096                       # 사용자당 프로세스 한도
chdev -l hdisk2 -a queue_depth=32 -P                 # 사용 중인 디스크는 -P 후 재부팅
chdev -l hdisk2 -a reserve_policy=no_reserve         # 공유 디스크(클러스터)
chdev -l fscsi0 -a dyntrk=yes -a fc_err_recov=fast_fail -P
chdev -l en0 -a netaddr=10.1.1.10 -a netmask=255.255.255.0 -a state=up
chdev -l inet0 -a hostname=aixhost02                 # 호스트 이름(영구)
lsattr -El hdisk2 -a queue_depth; lsattr -Pl hdisk2 -a queue_depth   # ODM 값과 마지막 구성 값(6.1)
영어 원문
  1. To change the retension instructions of the rmt0 4mm SCSI tape drive so that the drive does not move the tape to the beginning, then to the end, and then back to the beginning each time a tape is inserted or the drive is powered on, enter the following: chdev -l rmt0 -a ret=no

The system displays a message similar to the following: rmt0 changed

  1. To change one or more attributes of the tok0 token-ring adapter to preset values as described in the changattr file, enter the following:
chdev -l tok0 -f changattr

The system displays a message similar to the following:

tok0 changed
  1. To change the SCSI ID of the available scsi0 SCSI adapter that cannot be changed made unavailable due to available disk drives connected to it, enter the following:
chdev -l scsi0 -a id=6 -P

The system displays a message similar to the following:

scsi0 changed

To apply the change to the adapter, shut down and restart the system.

  1. To move the defined tty11 tty device to port 0 on the sa5 serial adapter, enter the following:
chdev -l tty11 -p sa5 -w 0

The system displays a message similar to the following:

tty11 changed
  1. To change the maximum number of processes allowed per user to 100, enter the following:
chdev -l sys0 -a maxuproc=100

The system displays a message similar to the following:

sys0 changed
  1. To delete the alias4=10.3.4.3 Object Data Manager (ODM) entry from the en2 standard Ethernet network interface, enter the following:
chdev -l en2 -a delalias4=10.3.4.3

The system displays a message similar to the following:

en2 changed
  1. To delete the alias6=fe80::20b4:40ff:fe00:f016/64 ODM entry from the en3 standard Ethernet network interface, enter the following:
chdev -l en3 -a delalias6=fe80::20b4:40ff:fe00:f016/64

The system displays a message similar to the following:

en3 changed
  1. To enable dynamic tracking for a FC adapter:
chdev -l fscsix -a dyntrk=yes
  1. To enable fast_fail for a FC adapter:
chdev -l fscsix -a fc_err_recov=fast_fail

파일

파일 설명
/usr/sbin/chdev 명령 파일
영어 원문
  • /usr/sbin/chdev — Specifies the command file.

Related information:

  • lsconn command
  • lsdev command
  • mkdev command
  • rmdev command

리눅스(GNU)와 다른 점

리눅스에는 ODM 같은 장치 구성 데이터베이스가 없고, 장치는 커널과 udev가 자동으로 인식합니다. 장치 목록은 lspci, lsusb, lsblk, lshw, ip link로, 속성은 /sys 아래 파일이나 udevadm info로 봅니다. 장치 다시 찾기는 echo "- - -" > /sys/class/scsi_host/host0/scan이나 rescan-scsi-bus.sh가 cfgmgr에 가깝습니다. 장치 속성은 /sys의 파일에 값을 쓰거나(echo 32 > /sys/block/sdb/device/queue_depth), 영구로는 udev 규칙·sysctl.conf·modprobe.d 옵션에 둡니다.