Solaris Block Devices and Mount / Un-mounting Options

Overview

Under Solaris, one of the most involved UNIX devices to understand is the disk device file. Here are several key points that may help:

In many cases, a disk device file (i.e. /dev/dsk/c0t2d0s7) refers to a particular partition (aka “slice”) of a disk, and not the entire physical device. There are several device files which refer to the entire physical device, but are rarely used.

For every disk device, there are usually two device files – the block device and the character (“raw”) device. In general:

block devices are generally stored under /dev/dsk and used for filesystem type access (e.g mount)

character devices are generally stored under /dev/rdsk used for everything else (e.g. fsck, newfs, etc..)

Discs are generally attached to a controller (or a bus) which can handle multiple devices. IDE and SCSI are both common attach methods. This tends to make disk device filename more complex than other types of devices.

/etc/vfstab

To see the difference between the block device and character device for a device, consider the following. The /etc/vfstab contains entries for a single filesystem on a Solaris server:

/dev/dsk/c0t2d0s7 /dev/rdsk/c0t2d0s7 /opt ufs 3 yes -

The first 2 fields in the above entry, list the same disk device as both a block device (“dsk”) and character device (“rdsk”). The block device is used by mount when mounting the filesystem while the character device is used by fsck when checking the filesystem and newfs when creating the filesystem.. Both fields must be present in /etc/vfstab.

Breaking Down c0t2d0s7

This section breaks down the different components of a disk device file. In this example, I will be using the disk device file: c0t2d0s7. The four components of the disk device file are: controller, target, LUN and slice/partition and further defined in the following table:

Sector or disk blocks : The smallest addressable unit on a platter. One sector can hold 512 bytes of data. Sectors are also known as disk blocks.

Track A series of sectors positioned end-to-end in a circular path.
Cylinder A stack of tracks.
Disk Slices Disks are logically divided into individual partitions known as disk slices
Controller number Identifies the host bus adapter (HBA), which controls communications between the system and disk unit.
The HBA takes care of sending and receiving both commands and data to the device. The controller
number is assigned in sequential order, such as c0, c1, c2, and so on.

Target number Target numbers, such as t0, t1, t2, and t3, correspond to a unique hardware address that is
assigned to each disk, tape, or CD-ROM. Some external disk drives have an address switch located
on the rear panel.

Disk number The disk number is also known as the logical unit number (LUN). This number reflects the number of
disks at the target location

Slice number A slice number ranging from 0 to 7.

Logical device names Logical disk device names are symbolic links to the physical device names kept in the
/devices directory.
Physical device names Physical device names uniquely identify the physical location of the hardware devices on the
system and are maintained in the /devices directory.

Instance names are abbreviated names assigned by the kernel for each device on the system

Listing a System’s Devices
Using the /etc/path_to_inst file
Using the prtconf command
Using the format command
devfsadm -c device_class

The values for device_class include disk, tape, port, audio, and pseudo.

For example, to restrict the devfsadm command to the disk device class, perform the command:

# devfsadm -c disk
Use the -c option more than once on the command line to specify multiple device classes. For example, to specify the disk, tape, and audio device classes, perform the command:
# devfsadm -c disk -c tape -c audio

syntax : devfsadm -i driver_name

To configure only those disks supported by the dad driver, perform the command:
# devfsadm -i dad

To configure only those disks supported by the sd driver, perform the command:
# devfsadm -i sd

The /etc/vfstab file lists all the file systems to be automatically mounted at system boot time, with the exception of the /etc/mnttab

# mount /dev/dsk/c0t0d0s7 /export/home
read/write Indicates whether reads and writes are allowed on the file system.
setuid Permits the execution of setuid programs in the file system.
intr/nointr Allows and forbids keyboard interrupts to kill a process that is waiting for an operation on a locked file
system.
logging Indicates that logging is enabled for the ufs file system. This is the default for the Solaris 10 OS.
largefiles Allows for the creation of files larger than 2 Gbytes. A file system mounted with this option can contain
files larger than 2 Gbytes
xattr Supports extended attributes not found in standard UNIX filesystems
onerror=action Specifies the action that the ufs file system should take to recover from an internal inconsistency on
a file system.
An action can be specified as:
panic—Causes a forced system shutdown. This is the default.
lock — Applies a file system lock to the file system.
umount — Forcibly unmounts the file system .
mount -o option,option,… device_name mount_point
ro – Mounts the file system as read-only
# mount -o ro /dev/dsk/c0t0d0s7 /export/home
nosuid – Prohibits the execution of setuid programs in the file system. This does not restrict the creation of setuid programs.
mount -o ro,nosuid /dev/dsk/c0t0d0s7 /export/home
noatime – Suppresses the time-last-accessed modification on inodes, which reduces disk activity on a file system where access times are not important. Specifying this option generally improves file access times and boosts overall performance
mount -o noatime /dev/dsk/c0t0d0s7 /export/home
nolargefiles – Prevents a file system that contains one or more “large files” from being mounted
mount -o nolargefiles /dev/dsk/c0t0d0s7 /export/home

Determining a File System’s Type
The /etc/vfstab file for the FS type field
The /etc/default/fs file for a local file system type
The /etc/dfs/fstypes file for a remote file system type

# fstyp /dev/rdsk/c0t0d0s7
ufs

# mount -F hsfs -o ro /dev/dsk/c0t6d0s0 /cdrom

# umount /export/home

# umountall —————>unmount manually all the file systems listed in the /etc/mnttab file
# umountall -l —————>To unmount only the local file systems listed in the /etc/mnttab file

# fuser -cu mount_point ——> displays who using the file system
# fuser -ck mount_point ——> Kill all processes accessing the file system