mkdev Command

Purpose

Adds a device to the system.

Syntax

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 ]

Description

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 (-c Class flag), type (-t Type flag), subclass (-s Subclass flag), connection location (-w ConnectionLocation flag), and the device logical name of the parent (-p ParentName flag)
  • Makes available the previously defined device specified by the given device logical name (-l Name 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 System Management Interface Tool (SMIT) smit mkdev fast path to run this command.

Flags

Item Description
-a Attribute=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 -a flag. Multiple attribute-value pairs must be enclosed in quotation marks with a blank space 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. This flag cannot be used with the -l flag unless the -c, -s, and -t flags are also used.
-c Class Specifies the device class.
-d Defines the device in the Customized Devices object class. If you specify the -d flag, the mkdev command does not make the device available. This flag cannot be used with the -S flag.
-f File Reads the necessary flags from the File parameter.
-h Displays the command usage message.
-l Name Specifies the predefined device, indicated by the Name variable, in the Customized Devices object class when not used with the -c, -s, and -t flags. The -a, -p, and -w flags cannot be used in this case. Queue device names must begin with an alphabetic character.
-p ParentName 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 -t flags. Not all devices support this feature. This flag cannot be used with the -l flag unless the -c, -s, and -t flags 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 -d and -S flags.
-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 -d flag.
-s Subclass Specifies the subclass, indicated by the Subclass variable, of the device.
-t Type Specifies the device type from the Predefined Devices object class.
-w ConnectionLocation Specifies the connection location, indicated by the ConnectionLocation variable, on the parent. This flag cannot be used with the -l flag unless the -c, -s, and -t flags are also used.

Exit Status

This command returns the following exit values:
Item Description
0 Successful completion.
>0 An error occurred.

Security

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

Examples

  1. To define (but not configure) a 4.0 GB 4mm Tape Drive connected to the scsi0 SCSI 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
  2. To make the predefined rmt0 tape device available to use, type the following:
    mkdev -l rmt0
    The system displays a message similar to the following:
    rmt0 available
  3. 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 foo file, 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

Files

Item Description
/usr/sbin/mkdev Contains the mkdev command.