Previous Page
Next Page

Managing File Systems

A file system is a structure of files and directories used to organize and store files on disks and other storage media. All disk-based computer systems have a file system. In Unix, file systems have two basic components: files and directories. A file is the actual information as it is stored on the disk, and a directory is a listing of the filenames. In addition to keeping track of filenames, the file system must also keep track of files' access dates, permissions, and ownership.

A hard disk consists of several separate disk platters mounted on a common spindle. Data stored on each platter surface is written and read by disk heads. The circular path a disk head traces over a spinning disk platter is called a track.

Each track is made up of a number of sectors laid end to end. A sector consists of a header, a trailer, and 512 bytes of data. The header and trailer contain error-checking information to help ensure the accuracy of the data. Taken together, the set of tracks traced across all of the individual disk platter surfaces for a single position of the heads is called a cylinder.

Devices and Drivers

In Solaris, each disk device is described in three ways, using three distinct naming conventions:

  • Physical device name Represents the full device pathname in the device information hierarchy.

  • Instance name Represents the kernel's abbreviation name for every possible device on the system.

  • Logical device name Used by system administrators with most system commands to refer to devices.

The system commands used to provide information about physical devices are described in Table 1.

Table 1. Device Information Commands

Command

Description

prtconf

Displays system configuration information, including the total amount of memory and the device configuration, as described by the system's hierarchy. This useful tool verifies whether a device has been seen by the system.

sysdef

Displays device configuration information, including system hardware, pseudo devices, loadable modules, and selected kernel parameters.

dmesg

Displays system diagnostic messages as well as a list of devices attached to the system since the most recent restart.


You can add new devices to a system without requiring a reboot if your system supports hot-plug devices. It's all handled by the devfsadmd daemon that transparently builds the necessary configuration entries. Older commands such as drvconfig, disks, tapes, ports, and devlinks have been replaced by the devfsadm utility. The devfsadm command should now be used in place of all these commands; however, devfsadmd, the devfsadm daemon, automatically detects device configuration changes, so there should be no need to run this command interactively.

During the process of building the /devices directory, the devfsadmd daemon assigns each device a major device number by using the name-to-number mappings held in the /etc/name_to_major file. This file is maintained by the system. The major device number indicates the general device class, such as disk, tape, or serial line. The minor device number indicates the specific member within that class.

The /dev/dsk directory refers to the block or buffered device file, and the /dev/rdsk directory refers to the character or raw device file. The "r" in rdsk stands for "raw."

Instance Names

The instance name represents the kernel's abbreviated name for every possible device on the system. For example, on an Ultra system, dad0 represents the instance name of the IDE disk drive, and hme0 is the instance name for the network interface. Instance names are mapped to a physical device name in the /etc/path_to_inst file.

File Systems

Following are the four types of disk-based file systems used by Solaris 10:

  • UFS The Unix file system, which is based on the BSD Fast file system (the traditional Unix file system). The UFS is the default disk-based file system used in Solaris.

  • HSFS The High Sierra and ISO 9660 file system. The HSFS is used on CD-ROMs and is a read-only file system.

  • PCFS The PC file system, which allows read/write access to data and programs on DOS-formatted disks.

  • UDF (Universal Disk Format) file system UDF is the industry-standard format for storing information on the optical media technology called DVD (Digital Versatile Disc).

Virtual file systems, previously called pseudo file systems, are virtual or memory-based file systems that create duplicate paths to other disk-based file systems or provide access to special kernel information and facilities. Most virtual file systems do not use file system disk space, although a few exceptions exist. The following is a list of some of the more common types of virtual file systems:

  • Cachefs The cache file system.

  • TMPFS The temporary file system uses local memory for file system reads and writes.

  • /var/run /var/run is the repository for temporary system files that are not needed across systems.

  • MNTFS The MNTFS type maintains information about currently mounted file systems.

  • DEVFS The DEVFS is used to manage the namespace of all devices on the system. This file system is used for the /devices directory.

Disks are divided into regions called disk slices or disk partitions using the format utility or the Solaris Management Console. Make sure you understand all of the Format menu options and what tasks they perform. The following displays the main menu options in the format utility:

disk - select a disk
    type - select (define) a disk type
    partition - select (define) a partition table
    current - describe the current disk
    format - format and analyze the disk
    repair - repair a defective sector
    label - write label to the disk
    analyze - surface analysis
    defect - defect list management
    backup - search for backup labels
    verify - read and display labels
    save - save new disk/partition definitions
    inquiry - show vendor, product and revision
    volname - set 8-character volume name
    !<cmd> - execute <cmd>, then return
    quit   -  Quit the format utility

Here are the menu options available in the partition section of the format utility:

PARTITION MENU:
  0 - change '0' partition
  1 - change '1' partition
  2 - change '2' partition
  3 - change '3' partition
  4 - change '4' partition
  5 - change '5' partition
  6 - change '6' partition
  7 - change '7' partition
  select - select a predefined table
  modify - modify a predefined partition table
  name - name the current table
  print - display the current table
  label - write partition map and label to the disk
  !<cmd> - execute <cmd>, then return
  quit   -  Quit the format utility

When you create a UFS, the disk slice is divided into cylinder groups. Disk configuration information is stored in the disk label. If you know the disk and slice number, you can display information for a disk by using the print volume table of contents (prtvtoc) command.

The slice is then divided into blocks to control and organize the structure of the files within the cylinder group. A UFS has the following four types of blocks. Each performs a specific function in the file system:

  • Bootblock Stores information used when booting the system

  • Superblock Stores much of the information about the file system

  • Inode Stores all information about a file except its name

  • Storage or data block Stores data for each file

File systems can be mounted from the command line by using the mount command. The commands in Table 2 are used from the command line to mount and unmount file systems.

Table 2. File System Commands

Command

Description

mount

Mounts specified file systems and remote resources

mountall

Mounts all file systems specified in a file system table (vfstab)

umount

Unmounts specified file systems and remote resources

umountall

Unmounts all file systems specified in a file system table


Common options used when mounting file systems are listed in Table 3.

Table 3. UFS Mount Options

Option

Description

-rw|ro

Specifies read/write or read-only. The default is read/write.

-nosuid

Disallows setuid execution and prevents devices on the file system from being opened. The default is to enable setuid execution and to allow devices to be opened.

-f

Fakes an entry in /etc/mnttab but doesn't really mount any file systems.

-n

Mounts the file system without making an entry in /etc/mnttab.

-largefiles

Specifies that a file system might contain one or more files larger than 2GB. It is not required that a file system mounted with this option contain files larger than 2GB, but this option allows such files within the file system. largefiles is the default.

-nolargefiles

Provides total compatibility with previous file system behavior, enforcing the 2GB maximum file size limit.

-logging/nologging

Enables/disables UFS logging on a file system; logging is the default in Solaris 10.


Use the df command and its options to see the capacity of each file system mounted on a system, the amount of space available, and the percentage of space already in use. Use the du (directory usage) command to report the number of free disk blocks and files.

Creating a UFS

mkfs constructs a file system on the character (or raw) device found in the /dev/rdsk directory. Again, it is highly recommended that you do not run the mkfs command directly, but instead use the friendlier newfs command, which automatically determines all the necessary parameters required by mkfs to construct the file system.

The /etc/vfstab (virtual file system table) file contains a list of file systems to be automatically mounted when the system is booted to the multi-user state. Each column of information follows this format:

  • device to mount The buffered device that corresponds to the file system being mounted.

  • device to fsck The raw (character) special device that corresponds to the file system being mounted. This determines the raw interface used by fsck. Use a dash (-) when there is no applicable device, such as for swap, /proc, tmp, or a network-based file system.

  • mount point The default mount point directory.

  • FS type The type of file system.

  • fsck pass The pass number used by fsck to decide whether to check a file. When the field contains a dash (-), the file system is not checked. When the field contains a value of 1 or greater, the file system is checked sequentially. File systems are checked sequentially in the order that they appear in the /etc/vfstab file. The value of the pass number has no effect on the sequence of file system checking.

  • mount at boot Specifies whether the file system should be automatically mounted when the system is booted. The RC scripts located in the /etc directory specify which file system gets mounted at each run level.

  • mount options A list of comma-separated options (with no spaces) used when mounting the file system. Use a dash (-) to show no options.

Use the fsck command to repair file systems. fsck is a multipass file system check program that performs successive passes over each file system, checking blocks and sizes, pathnames, connectivity, reference counts, and the map of free blocks (possibly rebuilding it). fsck also performs file system cleanup.

Volume Management

Volume management, with the vold daemon, is the mechanism that automatically mounts CD-ROMs and file systems when removable media containing recognizable file systems are inserted into the devices. The vold daemon is the workhorse behind volume manager. It is automatically started by the /etc/init.d/volmgt script. vold reads the /etc/vold.conf configuration file at startup. The vold.conf file contains the volume manager configuration information that vold uses.

Several other commands help you administer the volume manager on your system. They are described in Table 4.

Table 4. Volume Manager Commands

Command

Description

rmmount

Removable media mounter. Used by vold to automatically mount a /cdrom, /floppy, Jaz, or Zip drive if one of these media types is installed.

volcancel

Cancels a user's request to access a particular CD-ROM or floppy file system. This command, issued by the system administrator, is useful if the removable medium containing the file system is not currently in the drive.

volcheck

Checks the drive for installed media. By default, it checks the drive pointed to by /dev/diskette.

volmissing

Specified in vold.conf and notifies the user if an attempt is made to access a removable media type that is no longer in the drive.

vold

The volume manager daemon, controlled by /etc/vold.conf.

volrmmount

Simulates an insertion so that rmmount will mount the media, or simulates an ejection so that rmmount will unmount the media.


File systems are checked and repaired with the fsck (file system check) command. fsck is a multipass file system check program that performs successive passes over each file system, checking blocks and sizes, pathnames, connectivity, reference counts, and the map of free blocks (possibly rebuilding it). fsck also performs cleanup.


Previous Page
Next Page