rmdev 명령어 (AIX 5.3·6.1)
https://archive.horanglab.com/posts/aix-cmd-rmdev
핵심 정리
- 장치 구성을 풉니다. 기본은 Defined 상태로 두고 ODM의 정의는 남깁니다(
rmdev -l hdisk3). -d를 주면 ODM에서 정의까지 지웁니다(rmdev -dl hdisk3). 디스크를 뺀 뒤 남은 장치 정리, 경로 문제 해결 뒤 다시 찾을 때 씁니다.-R은 장치와 그 자식까지,-p 부모는 부모는 두고 자식만 다룹니다. 예:rmdev -Rdl fcs0(FC 어댑터와 아래 디스크 모두 지움).- 사용 중인 장치(마운트된 디스크, 활성 VG의 디스크 등)는 풀 수 없습니다. 먼저 사용을 멈춥니다.
- 지운 장치는
cfgmgr로 다시 찾을 수 있습니다. 중간에 멈추면 ODM이 망가질 수 있어 인터럽트되지 않습니다.
| 항목 | 내용 |
|---|---|
| 버전 | AIX 5.3, AIX 6.1 (6.1에서 -g(잠긴 장치에 강제로)가 더해짐) |
| 원문 | IBM Commands Reference — 5.3 Volume 4, 6.1 Volume 4 |
| 파일 | /usr/sbin/rmdev |
| 관련 명령어 | mkdev, chdev, lsdev, cfgmgr, lsparent |
목적
시스템에서 장치를 지웁니다.
영어 원문
Removes a device from the system.
구문
rmdev { -l | -p } Name [ -d | -S ] [ -f File ] [ -h ] [ -q ] [ -R ] [ -g ]
-g는 6.1 구문에만 있습니다.
설명
참고: -p를 주면 -l을 줄 수 없습니다. -p와 함께 준 -R은 무시합니다.
rmdev 명령은 -l Name으로 지정한 장치의 구성을 풀거나, 구성을 풀고 정의도 지웁니다. 기본 동작은 구성을 풀되 사용자 정의 장치 객체 클래스의 장치 정의는 남깁니다.
-S를 주면 Stopped 상태를 지원하는 장치를 Stopped 상태로 둡니다. -d를 주면 사용자 정의 장치 객체 클래스에서 장치 정의를 지웁니다(undefine). -d가 없으면 장치를 Defined 상태로 둡니다(unconfigure). -R을 주면 그 장치의 자식에도 같은 일을 합니다.
-p에 부모 장치의 논리 이름을 주면 그 자식 장치를 모두 풀거나 지웁니다. 자식은 -R처럼 재귀로 다루지만, 지정한 장치 자신은 풀거나 지우지 않습니다.
주의: 구성 데이터베이스를 보호하려고 rmdev는 인터럽트되지 않습니다. 끝나기 전에 멈추면 데이터베이스가 망가질 수 있습니다.
Web-based System Manager의 Devices 응용 프로그램이나 SMIT 빠른 경로 smit rmdev로도 실행할 수 있습니다.
영어 원문
Note: The -l flag cannot be specified if -p is specified. If the -R flag is specified along with the -p flag, it will be ignored.
The rmdev command unconfigures or both unconfigures and undefines the device specified with the device logical name using the -l Name flag. The default action unconfigures the device but retains its device definition in the Customized Devices object class.
If you specify the -S flag, the rmdev command sets the device to the Stopped state for devices that support the Stopped state. If you specify the -d flag, the rmdev command deletes the device definition from the Customized Devices object class (undefines). If you do not specify the -d flag, the rmdev command sets the device to the Defined state (unconfigures). If you specify the -R flag, the rmdev command acts on any children of the device as well.
Use the -p flag along with the parent device's logical name to unconfigure or delete all of the children devices. The children are unconfigured or deleted in the same recursive fashion as described for the -R flag, but the specified device itself is not unconfigured or deleted.
Attention: To protect the Configuration database, the rmdev command is not interruptible. Stopping this command before it is complete could result in a corrupted database.
You can also use the Devices application in Web-based System Manager, or the System Management Interface Tool (SMIT)smit rmdev fast path to run this command.
플래그
| 플래그 | 설명 |
|---|---|
-d |
사용자 정의 장치 객체 클래스에서 장치 정의를 지웁니다. -S와 함께 쓸 수 없습니다. |
-f File |
필요한 플래그를 File에서 읽습니다. |
-g |
잠긴 장치에도 지우기를 강제로 합니다. 6.1부터 |
-h |
사용법을 보여 줍니다. |
-l Name |
사용자 정의 장치 객체 클래스의 논리 장치. -p와 함께 쓸 수 없습니다. |
-p Name |
자식을 지울 부모 논리 장치. -l과 함께 쓸 수 없습니다. |
-q |
표준 출력과 표준 오류의 메시지를 막습니다. |
-R |
장치와 그 자식의 구성을 풉니다. -d나 -S와 함께면 자식도 각각 정의를 지우거나 멈춥니다. |
-S |
장치에 Stop 메서드가 있으면 불러 사용할 수 없게 합니다. -d와 함께 쓸 수 없습니다. |
영어 원문
-d— Removes the device definition from the Customized Devices object class. This flag cannot be used with the-Sflag.-fFile — Reads the necessary flags from the File parameter.-g— Forces the remove operation to run on a locked device.-h— Displays the command usage message.-lName — Specifies the logical device, indicated by the Name parameter, in the Customized Devices object class. This flag cannot be used with the-pflag.-pName — Specifies the parent logical device (indicated by the Name parameter) in the Customized Devices object class, with children that must be removed. This flag may not be used with the-lflag.-q— Suppresses the command output messages from standard output and standard error.-R— Specifies to unconfigure the device and its children. When used with the-dor-Sflags, the children are undefined or stopped, respectively.-S— Makes the device unavailable by calling the Stop method if the device has a Stop method. This flag cannot be used with the-dflag.
종료 상태
| 값 | 뜻 |
|---|---|
| 0 | 성공 |
| 0보다 큼 | 오류 |
영어 원문
This command returns the following exit values:
- 0 — Successful completion.
>0— An error occurred.
보안
권한 제어: root와 system 그룹 구성원만 이 명령의 실행(x) 권한을 가져야 합니다.
감사 이벤트: DEV_Stop, DEV_Unconfigure, DEV_Remove(모두 장치 이름).
RBAC 사용자와 Trusted AIX 사용자는 주의하세요. 이 명령은 특권 작업을 할 수 있으며, 특권 작업은 특권 사용자만 할 수 있습니다. 특권과 권한 목록은 lssecattr 명령이나 getcmdattr 하위 명령으로 봅니다(6.1).
영어 원문
Privilege Control: Only the root user and members of the system group should have execute (x) access to this command.
Auditing Events:
Event Information DEV_Stop Device name DEV_Unconfigure Device name DEV_Remove Device name
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.
예제
| 명령 | 하는 일 | 출력 |
|---|---|---|
rmdev -l cd0 |
CD-ROM cd0의 구성을 풀고 정의는 남김 |
cd0 defined |
rmdev -d -l cd0 |
cd0의 정의를 지움 |
cd0 deleted |
rmdev -R -l scsi1 |
SCSI 어댑터 scsi1과 그 자식의 구성을 풀고 정의는 남김 |
rmt0 Defined, hdisk1 Defined, scsi1 Defined |
rmdev -p scsi1 |
scsi1은 두고 그 자식만 구성을 풂 |
rmt0 Defined, hdisk1 Defined |
rmdev -p pci1 |
PCI 버스 pci1 아래의 모든 장치의 구성을 풂 |
rmt0 Defined, hdisk1 Defined, scsi1 Defined, ent0 Defined |
자주 쓰는 형태:
rmdev -dl hdisk5 # 뺀 디스크 정의 지우기
lsdev -Cc disk -S d | awk '{print $1}' | xargs -n1 rmdev -dl # Defined 디스크 모두 정리
rmdev -Rdl fcs1 # FC 어댑터와 아래 장치 모두 지우기
cfgmgr -vl fcs1 # 다시 찾기
rmdev -l en1 # 인터페이스 내리기(정의는 남김)
영어 원문
- To unconfigure the
cd0CD-ROM device while retaining its device definition in the Customized Devices object class, type the following:rmdev -l cd0
The system displays a message similar to the following: cd0 defined
- To remove the
cd0CD-ROM device definition from the Customized Devices object class, type the following:rmdev -d -l cd0
The system displays a message similar to the following: cd0 deleted
- To unconfigure the
scsi1SCSI adapter and all of its children while retaining their device definitions in the Customized Devices object class, type the following:rmdev -R -l scsi1
The system displays a message similar to the following: rmt0 Defined hdisk1 Defined scsi1 Defined
- To unconfigure the children of the
scsi1SCSI adapter, but not the adapter itself, while retaining their device definitions in the Customized Devices object class, type the following:rmdev -p scsi1
The system displays a message similar to the following: rmt0 Defined hdisk1 Defined
- To unconfigure the children of the
pci1PCI bus and all other devices under them while retaining their device definitions in the Customized Devices object class, type the following:rmdev -p pci1
The system displays a message similar to the following: rmt0 Defined hdisk1 Defined scsi1 Defined ent0 Defined
파일
| 파일 | 설명 |
|---|---|
/usr/sbin/rmdev |
rmdev 명령 |
영어 원문
- /usr/sbin/rmdev — Contains the rmdev command.
Related information:
- chdev command
- lsattr command
- lsparent command
- mkdev 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에 가깝습니다. 디스크를 지우는 일은 echo 1 > /sys/block/sdX/device/delete, 드라이버를 내리는 일은 modprobe -r 모듈로 합니다.