Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
  Previous   Contents   Next 
   
 
Chapter 29

Accessing Devices (Overview)

This chapter provides information about how to access the devices on a system.

This is a list of the overview information in this chapter.

For overview information about configuring devices, see Chapter 26, Managing Devices (Tasks).

Accessing Devices

You need to know how to specify device names when using commands to manage disks, file systems, and other devices. In most cases, you can use logical device names to represent devices 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, and provides a set of pointers to the drivers that perform specific operations. For more information on device hierarchy, see OpenBoot 3.x Command Reference Manual.

How Devices Are Managed

The devfsadm command manages the special device files in the /dev and /devices directories. By default, the devfsadm command attempts to load every driver in the system and attach to all possible device instances. Then it creates the device files in the /devices directory and the logical links in the /dev directory. In addition to managing the /dev and /devices directories, the devfsadm command also maintains the path_to_inst(4) instance database.

Both reconfiguration boot processing and updating the /dev and /devices directories in response to dynamic reconfiguration events is handled by devfsadmd, the daemon version of the devfsadm command. This daemon is started from the /etc/rc* scripts when a system is booted.

Since the devfsadmd daemon automatically detects device configuration changes generated by any reconfiguration event, there is no need to run this command interactively.

For more information, see devfsadm(1M).

Device Naming Conventions

Devices are referenced in three ways in the Solaris environment.

  • Physical device name - Represents the full device pathname in the device information hierarchy. Physical device names are displayed by using the following commands:

    • dmesg

    • format

    • sysdef

    • prtconf

    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 and are displayed by using the following commands:

    • dmesg

    • sysdef

    • prtconf

  • Logical device name - Used with most file system commands to refer to devices. For a list of file commands that use logical device names, see Table 29-1. Logical device files in the /dev directory are symbolically linked to physical device files in the /devices directory.

Logical Disk Device Names

Logical device names are used to access disk devices when you:

  • Add a new disk to the system

  • Move a disk from one system to another

  • Access (or mount) a file system residing on a local disk

  • Back up a local file system

Many administration commands take arguments that refer to a disk slice or file system.

Refer to a disk device by specifying the subdirectory to which it is symbolically linked (either /dev/dsk or /dev/rdsk), followed by a string identifying the particular controller, disk, and slice.

Figure 29-1 Logical Device Names

Specifying the Disk Subdirectory

Disk and file administration commands require the use of either a raw (or character) device interface, or a block device interface. The distinction is made by how data is read from the device.

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.

Different commands require different interfaces.

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

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

  • When you're not sure whether a command requires use of /dev/dsk or /dev/rdsk, check the man page for that command.

The following table shows which interface is required for a few commonly used disk and file system commands.

Table 29-1 Device Interface Type Required by Some Frequently Used Commands

Command

Interface Type

Example of Use

df(1M)

Block

df /dev/dsk/c0t3d0s6

fsck(1M)

Raw

fsck -p /dev/rdsk/c0t0d0s0

mount(1M)

Block

mount /dev/dsk/c1t0d0s7 /export/home

newfs(1M)

Raw

newfs /dev/rdsk/c0t0d1s1

prtvtoc(1M)

Raw

prtvtoc /dev/rdsk/c0t0d0s2

 
 
 
  Previous   Contents   Next