mkdev 명령어 (AIX 5.3·6.1)
https://archive.horanglab.com/posts/aix-cmd-mkdev
핵심 정리
- 장치를 시스템에 더합니다. 새 장치를 정의하고 사용할 수 있게 하거나(
-c,-s,-t), 이미 정의된(Defined) 장치를 Available로 만듭니다(-l). - 가장 많이 쓰는 형태는
mkdev -l hdisk3이나mkdev -l en0처럼 Defined 상태의 장치를 다시 쓰게 하는 것입니다. -d는 정의만 하고(Defined),-S는 Stopped 상태로 두며,-R은 아직 구성되지 않은 부모 장치까지 구성합니다.- 새 장치를 만들 때는 클래스·하위 클래스·유형(
lsdev -P로 봄), 부모(-p), 연결 위치(-w)를 줍니다. 대부분의 하드웨어는cfgmgr가 자동으로 찾으므로 손으로 만들 일은 tty, 의사 장치 등에 한정됩니다. - 중간에 멈추면 ODM이 망가질 수 있어 인터럽트되지 않습니다.
| 항목 | 내용 |
|---|---|
| 버전 | AIX 5.3, AIX 6.1 (내용이 같고, 6.1 문서에 RBAC 안내가 더해짐) |
| 원문 | IBM Commands Reference — 5.3 Volume 3, 6.1 Volume 3 |
| 파일 | /usr/sbin/mkdev |
| 관련 명령어 | rmdev, chdev, lsdev, lsattr, lsparent, lsconn, cfgmgr |
목적
시스템에 장치를 더합니다.
영어 원문
Adds a device to the system.
구문
mkdev { -c Class -s Subclass -t Type } [ -l Name ] [ -a Attribute=Value ] ... [ -d | -S | -R ] [ -f File ]
[ -h ] [ -p ParentName ] [ -q ] [ -w ConnectionLocation ]
mkdev -l Name [ -h ] [ -q ] [ -S ]
설명
주의: 구성 데이터베이스를 보호하려고 mkdev는 인터럽트되지 않습니다. 끝나기 전에 멈추면 데이터베이스가 망가질 수 있습니다.
mkdev 명령은 다음 일을 합니다.
- 장치 클래스(
-c), 유형(-t), 하위 클래스(-s), 연결 위치(-w), 부모 장치 논리 이름(-p)으로 장치를 정의하고 사용할 수 있게 합니다. - 논리 이름(
-l)으로 지정한, 이미 정의된 장치를 사용할 수 있게 합니다.
-c, -s, -t는 사전 정의 장치를 하나로 정하는 데 필요한 만큼 조합해 씁니다.
-d를 주면 장치를 정의만 합니다. -S를 주면 그 상태를 지원하는 장치를 Stopped 상태로 두고 사용할 수 있게 하지는 않습니다. 둘 다 없으면 장치를 사용할 수 있게 합니다.
-R을 주면 지정한 장치의 부모 가운데 이미 정의됐지만 아직 구성되지 않은 것을 구성합니다. -R은 -d, -S와 함께 쓸 수 없습니다.
-c, -s, -t와 함께 -l을 주면 장치 이름을 정할 수 있습니다. -l이 없으면 이름을 자동으로 만들어 줍니다. 모든 장치가 사용자가 준 이름을 지원하지는 않습니다.
참고: 큐 장치 이름은 영문자로 시작해야 합니다.
플래그는 명령줄에서 주거나 -f File로 파일에서 읽습니다. Web-based System Manager의 Devices 응용 프로그램(wsm devices)이나 SMIT 빠른 경로 smit mkdev로도 실행할 수 있습니다.
영어 원문
Attention: To protect the Configuration Database, the mkdev command is not interruptible. Stopping this command before it is complete could result in a corrupted database.
The mkdev command performs the following:
Defines and makes available a device with the given device class (
-cClass flag), type (-tType flag), subclass (-sSubclass flag), connection location (-wConnectionLocation flag), and the device logical name of the parent (-pParentName flag)Makes available the previously defined device specified by the given device logical name (
-lName flag).
You can use any combination of the -c, -s, and -t flags you need to uniquely identify the predefined device.
If you specify the -d flag, the mkdev command only defines the device. If you specify the -S flag, the mkdev command brings the device to the Stopped state, if this state is supported, and does not make the device available. If you do not specify either the -d flag or the -S flag, the mkdev command makes the device available.
If you specify the -R flag, the mkdev command configures any previously-defined parents of the specified device that are not already configured. The -R flag is not compatible with the -d and -S flags.
By using the -l flag with the -c, -s, and -t flags, you can specify the name of the device. If you do not use the -l flag, a name will be automatically generated and assigned. Not all devices support user-supplied names.
Note: Queue device names must begin with an alphabetic character.
When using the mkdev command, you can supply the flags either on the command line or in the specified -f File flag.
You can use the Web-based System Manager Devices application (wsm devices fast path), or the System Management Interface Tool (SMIT) smit mkdev fast path to run this command.
플래그
| 플래그 | 설명 |
|---|---|
-a Attribute=Value |
기본값 대신 쓸 속성-값 쌍. -a 하나에 여러 쌍을 줄 때는 따옴표로 감싸고 공백으로 나눕니다. -c, -s, -t도 함께 주지 않는 한 -l과 함께 쓸 수 없습니다. |
-c Class |
장치 클래스. |
-d |
사용자 정의 장치 객체 클래스에 장치를 정의만 하고 사용할 수 있게 하지는 않습니다. -S와 함께 쓸 수 없습니다. |
-f File |
필요한 플래그를 File에서 읽습니다. |
-h |
사용법을 보여 줍니다. |
-l Name |
-c, -s, -t 없이 쓰면 사용자 정의 장치 객체 클래스에 정의된 장치를 Name으로 지정합니다. 이때 -a, -p, -w는 쓸 수 없습니다. 큐 장치 이름은 영문자로 시작해야 합니다. |
-p ParentName |
-c, -s, -t와 함께 쓸 때 장치에 줄 부모 장치 이름. 모든 장치가 지원하지는 않으며, -c, -s, -t 없이 -l과 함께 쓸 수 없습니다. |
-q |
표준 출력과 표준 오류의 메시지를 막습니다. |
-R |
장치의 부모 가운데 아직 구성되지 않은 것을 구성합니다. -d, -S와 함께 쓸 수 없습니다. |
-S |
장치를 Available 상태로 만들지 않습니다. Stopped 상태를 지원하는 장치에만 의미가 있고 -d와 함께 쓸 수 없습니다. |
-s Subclass |
장치의 하위 클래스. |
-t Type |
사전 정의 장치 객체 클래스의 장치 유형. |
-w ConnectionLocation |
부모에서의 연결 위치. -c, -s, -t도 함께 주지 않는 한 -l과 함께 쓸 수 없습니다. |
영어 원문
-aAttribute=Value — Specifies the device attribute-value pairs to be used instead of the defaults. The Attribute=Value variable can be used to specify one attribute value pair or multiple attribute value pairs for one-aflag. Multiple attribute-value pairs must be enclosed in quotation marks with a blank space between the pairs. For example, entering-a Attribute=Valuelists one attribute value pair per flag, while entering-a 'Attribute1=Value1 Attribute2=Value2'lists more than one attribute value pair. This flag cannot be used with the-lflag unless the-c,-s, and-tflags are also used.-cClass — Specifies the device class.-d— Defines the device in the Customized Devices object class. If you specify the-dflag, the mkdev command does not make the device available. This flag cannot be used with the-Sflag.-fFile — Reads the necessary flags from the File parameter.-h— Displays the command usage message.-lName — Specifies the predefined device, indicated by the Name variable, in the Customized Devices object class when not used with the-c,-s, and-tflags. The-a,-p, and-wflags cannot be used in this case. Queue device names must begin with an alphabetic character.-pParentName — Specifies the device name, indicated by the ParentName variable, that you want assigned to the device when it is used with the-c,-s, and-tflags. Not all devices support this feature. This flag cannot be used with the-lflag unless the-c,-s, and-tflags are also used.-q— Suppresses the command output messages from standard output and standard error.-R— Configures any parents of the device that are not already configured. This flag cannot be used with the-dand-Sflags.-S— Prevents the device from being set to the Available state. This flag is only meaningful for those devices that support the Stopped state. This flag cannot be used with the-dflag.-sSubclass — Specifies the subclass, indicated by the Subclass variable, of the device.-tType — Specifies the device type from the Predefined Devices object class.-wConnectionLocation — Specifies the connection location, indicated by the ConnectionLocation variable, on the parent. This flag cannot be used with the-lflag unless the-c,-s, and-tflags are also used.
종료 상태
| 값 | 뜻 |
|---|---|
| 0 | 성공 |
| 0보다 큼 | 오류 |
영어 원문
This command returns the following exit values:
- 0 — Successful completion.
>0— An error occurred.
보안
권한 제어: root와 system 그룹 구성원만 이 명령의 실행(x) 권한을 가져야 합니다.
감사 이벤트: DEV_Create(메서드 이름, 매개변수), DEV_Configure(오류), DEV_Start(장치 이름), DEV_Change(매개변수).
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.
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.
Auditing Events:
Event Information DEV_Create Method name, parameters DEV_Configure Errors DEV_Start Device name DEV_Change Parameters
예제
| 명령 | 하는 일 | 출력 |
|---|---|---|
mkdev -d -c tape -t 4mm2gb -s scsi -p scsi0 -w 5,0 |
scsi0 어댑터에 SCSI ID 5, LUN 0으로 붙은 4mm 테이프를 정의만 함(구성은 안 함) |
rmt4 defined |
mkdev -l rmt0 |
정의된 테이프 rmt0을 사용할 수 있게 함 |
rmt0 available |
mkdev -t tty -s rs232 -p sa3 -w 0 -a speed=19200 -f foo |
IBM 8포트 어댑터(sa3)의 포트 0에 RS-232 tty를 속도 19200, 나머지 속성은 파일 foo의 값으로 정의하고 구성 |
tty0 available |
자주 쓰는 형태:
lsdev -C -S d # Defined 상태 장치 찾기
mkdev -l hdisk3 # 다시 Available로
mkdev -l en1 # 인터페이스 올리기(속성은 ODM 값)
mkdev -l fcs0 -R # 부모까지 함께 구성
영어 원문
- To define (but not configure) a 4.0 GB 4mm Tape Drive connected to the
scsi0SCSI adapter and using SCSI ID 5 and LUN of 0, type the following:mkdev -d -c tape -t4mm2gb -s scsi -p scsi0 -w 5,0
The system displays a message similar to the following: rmt4 defined
- To make the predefined
rmt0tape device available to use, type the following:mkdev -l rmt0
The system displays a message similar to the following: rmt0 available
- To define and configure an RS-232 tty device connected to port 0 on the IBM 8-Port EIA-232/RS-422A (PCI) Adapter with the speed attribute set to 19200, and other attributes set from the
foofile, type the following:
mkdev -t tty -s rs232 -p sa3 -w 0 -a speed=19200 -f foo
The system displays a message similar to the following:
tty0 available
파일
| 파일 | 설명 |
|---|---|
/usr/sbin/mkdev |
mkdev 명령 |
영어 원문
- /usr/sbin/mkdev — Contains the mkdev command.
Related reference:
- lsattr Command
- lsconn Command
- lsdev Command
- lsparent 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에 가깝습니다. 장치를 손으로 올리는 일은 modprobe 모듈(드라이버 올리기)이나 ip link set dev up, 디스크 다시 찾기로 합니다.