Go to main content

Managing Devices in Oracle® Solaris 11.4

Exit Print View

Updated: November 2020
 
 

Accessing Devices

To manage disks, file systems, and other devices, you must know how to specify device names. In most cases, you can use logical device names to represent devices that are connected to the system. Both logical and physical device names are represented on the system by logical and physical device files.

How Device Information Is Created

When a system is booted for the first time, a device hierarchy is created to represent all the devices connected to the system. The kernel uses the device hierarchy information to associate drivers with their appropriate devices. The kernel also provides a set of pointers to the drivers that perform specific operations.

    The device hierarchy consists of the following directories:

  • /devices – The name space of all devices on the system. This directory represents the physical devices that consists of actual bus and device addresses. The devfs file system manages this directory.

  • /dev – The name space of logical device names. The dev file system manages this directory.

    The devfsadm command manages system devices by performing the following operations:

  • It attempts to load every driver in the system and attach the drivers to all possible device instances.

  • It creates the device files in the /devices directory and the logical links in the /dev directory.

  • It maintains the path_to_inst instance database.

The devfsadmd daemon automatically updates the /dev and /devices directories in response to dynamic reconfiguration events or file system accesses. This daemon is started by the service management facility when a system is booted.

Device Naming Conventions

    In Oracle Solaris, devices are referenced in one of three ways:

  • Physical device name – Represents the full device path name in the device information hierarchy. The physical device name is created by when the device is first added to the system. Physical device files are found in the /devices directory.

  • Instance name – Represents the kernel's abbreviation name for every possible device on the system. For example, sd0 and sd1 represent the instance names of two disk devices. Instance names are mapped in the /etc/path_to_inst file.

  • Logical device name – The logical device name is created when the device is first added to the system. You use logical device names with most file system commands to refer to devices.Logical device files in the /dev directory are symbolically linked to physical device files in the /devices directory.

    The following commands display device name information:

  • dmesg

  • format

  • sysdef

  • prtconf

Logical Disk Device Names

    You use logical device names to access disk devices when you perform the following tasks:

  • Add a new disk to the system.

  • Move a disk from one system to another system.

  • Access or mount a file system residing on a local disk.

  • Back up a local file system.

Names of logical devices use the format /dev/[r]dsk/cntndn[sn,pn].

dev

Devices directory.

[r]dsk

Disk device subdirectory (see Disk Subdirectory for more information)

cn

Logical controller number

tn

Physical bus target number

dn

Drive number

[sn,pn]

Slice number (s0 to s7) or fdisk partition number (p0 to p4).

For information about specifying disk partitions or slices, see Direct and Bus-Oriented Controllers.

Disk Subdirectory

Some disk and file administration commands require the use of either a raw (or character) device interface or a block device interface. Raw device interfaces transfer only small amounts of data at a time. Block device interfaces include a buffer from which large blocks of data are read at once.

The disk subdirectory you specify depends on the device interface required by the command.

  • When a command requires the raw device interface, specify the /dev/rdsk subdirectory. (The "r" in rdsk stands for "raw".)

    For example: prtvtoc /dev/rdsk/c0t0d0s0

  • When a command requires the block device interface, specify the /dev/dsk subdirectory.

    For example: dumpadm -d /dev/zvol/dsk/rpool/dump

If you are not sure whether a command requires use of /dev/dsk or /dev/rdsk, check the man page for that command.

Direct and Bus-Oriented Controllers

You access disk partitions or slices differently depending upon whether the disk device is connected to a direct or bus-oriented controller. Generally, direct controllers do not include a target identifier in the logical device name.


Note -  Controller numbers are assigned automatically during system initialization. The numbers are strictly logical and imply no direct mapping to physical controllers.

Both direct and bus-oriented controller names use the following conventions:

cn

Logical controller number

dn

Drive number

[sn,pn]

Slice number (s0 to s7) or fdisk partition number (p0 to p4)

  • To specify a slice on a disk with an IDE controller, use the naming convention cndn[sn,pn].

    To indicate the entire fdisk partition, specify slice 2 (s2).

  • To specify a slice on a disk with a bus-oriented controller, SCSI for example, you would add the physical bus target number (tn): cntndn[sn,pn].

    To indicate the whole disk, specify slice 2 (s2).

Logical Tape Device Names

Logical tape device files are listed in the /dev/rmt/* directory as symbolic links from the /devices directory. The naming convention is /dev/rmt/nd.

dev

Devices directory

rmt

Raw magnetic tape device directory

n

Drive number (0-)

d

Optional density, which can be l (low), m (medium), h (high), u (ultra), or c (compressed).

The first tape device connected to the system is 0 (/dev/rmt/0). For information about tape density values, see Managing Tape Drives Tasks.

Logical Removable Media Device Names

Because removable media is managed by removable media management services, the logical device name is usually not used unless you want to mount the media manually.

For information about the logical device names that represent the removable media devices on a system, see Accessing Removable Media.