6    Administering UNIX File Systems (UFS)

This chapter introduces file systems and the basic system administration tasks related to file systems. Several file systems are supported, but the Advanced File System (AdvFS) and UNIX File System (UFS) are the principal file systems used by applications and the components of the UNIX operating system. If your system was delivered with the operating system already installed, the AdvFS is configured as the default file system. See the AdvFS Administration manual for information on administering AdvFS.

This chapter discusses system administration tasks related to the following file system topics:

There are several other sources of information about system administration tasks and file systems. This chapter directs you to those sources when appropriate.

6.1    Introduction to File Systems

If you installed the operating system yourself, you may have chosen to create one or more UFS file systems. Even if your system arrived configured for AdvFS, you still can create UFS file systems. Both file systems can coexist on a system and many administrators choose to use the familiar UFS file system on system disks or in instances where the advanced features of AdvFS are not required.

The operating system supports current versions of several file systems, including:

You may need to see the following volumes:

The rest of this section, and the following sections, introduce concepts that are important in the context of creating and administering file systems. The information is not essential for basic file system creation and administration, but it may be useful if you plan to perform advanced operations or perform troubleshooting tasks.

The following list provides a brief overview of the topics, with detailed information in the sections that follow:

Directory Hierarchy

Any file system, whether local or remotely mounted, is part of the total directory hierarchy of a system or cluster. It can be considered as a tree, growing from the root file system (/) and branching as additional directories are added to the basic system hierarchy. When you create a UFS file system, such as /usr/usrs/projects, you add it as a new branch on the hierarchy, under the existing /usr/usrs branch.

Disk Partitions

The common form of file system storage on all systems is the hard disk. The administration of such devices is described in Hardware Management manual. A disk is divided into logical partitions, which may be the whole disk (partition c) or parts of the disk, such as partitions a through h. Depending on the size of the disk, the partitions vary in size, and are usually expressed in megabytes (MB). When you initially create a file system, you create it on a disk partition and thus assign a finite amount of size (disk space) to that file system. Increasing the size of a UFS file system may involve moving it to a bigger partition or disk.

File System Structures

A file system has an on-disk data structure that describes the layout of data on the physical media. You may need to know this structure to troubleshoot the file system or perform advanced operations such as tuning. For most common operations, you do not need to know this information in detail. Reference information is provided in the following sections.

Directories and File Types

The various directory and file types are displayed in the output of common commands that you use. Reference information is provided so that you can identify file types such as symbolic links or sockets. For more detailed information, see the appropriate reference page as follows:

Regular files

file(1)

Directories

ls(1) and dir(4)

Device Special Files

The Hardware Management manual

Sockets

socket(2), the Network Administration: Connections manual, and the Network Programmer's Guide

Pipes

pipe(2)

Symbolic links

link(1) and ln(1)

6.1.1    Directory Hierarchy for File Systems

The location of file systems is based on the UNIX directory hierarchy, beginning with a root (/) directory. The file systems that you create become usable (or active) when they are mounted on a mount point in the directory hierarchy. For example, during installation of the operating system, you may have created the usr file system (as UFS), which is then automatically mounted on root (/) and has a pathname of /usr in the hierarchy.

The standard system directory hierarchy is set up for efficient organization. It separates files by function and intended use. Effective use of file systems includes placing command files in directories that are in the normal search path as specified by a user's setup file, such as .cshrc, .profile, or .login. Some of the directories are actually symbolic links. See hier(5) for more information about the operating system's directory hierarchy, including the hierarchy of the X11 Windows System.

Mounting a file system makes it available for use. Use the mount command to attach (or mount) file systems to the file system hierarchy under the system root directory; use the umount command to detach (or unmount) them. When you mount a file system, you specify a location (the mount point under the system root directory) to which the file system attaches. See mount(8) for more information about mounting and unmounting file systems.

The root directory of a mounted file system is also its mount point. Only one system root directory can exist on a system, because it uses the root directory as its source for system initialization files. Consequently, all file systems that are local to an operating system are mounted under that system's root directory.

6.1.2    Disk Partitions

A disk consists of physical storage units called sectors. Each sector is usually 512 bytes. A sector is addressed by the logical block number (LBN), which is the basic unit of the disk's user-accessible data area that you can address. The first LBN is numbered 0, and the highest LBN is numbered one less than the number of LBNs in the user-accessible area of the disk.

Sectors are grouped together to form up to eight disk partitions. However, disks differ in the number and size of partitions. The /etc/disktab file contains a list of supported disks and the default partition sizes for the system. See disktab(4) for more information.

Disk partitions are logical divisions of a disk that allow you to organize files by putting them into separate areas of varying sizes. Partitions hold data in structures called file systems and can be used for system operations such as paging and swapping. File systems have a hierarchical structure of directories and files, as shown in hier(5).

Disk partitions have default sizes that depend on the type of disk and that can be altered by using the disklabel command or the diskconfig graphical user interface. Partitions are named a to h. While it is possible for you to make the allocated space for a partition overlap another partition, the default partitions are never overlapping, and a properly used disk must not have file systems on overlapping partitions.

shows the default partitioning for a model RZ1DF-CB disk, using the following command:

# disklabel -r /dev/rdisk/dsk0a

Only the disk table part of the output is shown here. Also listed is an example of an RZ1DF-CB Disk and HSZ RAID disk, taken from rz(7).

Example 6-1:  Default Partitions

(RZ1DF-CB Disk)
 
8 partitions:
#          size    offset    fstype  [fsize bsize   cpg] # NOTE: values not exact
  a:     262144         0    4.2BSD    1024  8192    16       # (Cyl.    0 - 78*)
  b:    1048576    262144      swap                           # (Cyl.   78*- 390*)
  c:   17773524         0    unused       0     0             # (Cyl.    0 - 5289*)
  d:    1048576   1310720      swap                           # (Cyl.  390*- 702*)
  e:    9664482   2359296     AdvFS                           # (Cyl.  702*- 3578*)
  f:    5749746  12023778    unused       0     0             # (Cyl. 3578*- 5289*)
  g:    1433600    524288    unused       0     0             # (Cyl.  156*- 582*)
  h:   15815636   1957888    unused       0     0             # (Cyl.  582*- 5289*)
 
HSZ10, HSZ40, HSZ50, HSZ70  (RAID) Partitions
 
       Disk      Start     Length
 
       dsk?a     0         131072
       dsk?b     131072    262144
       dsk?c     0         end of media
       dsk?d     0         0
       dsk?e     0         0
       dsk?f     0         0
       dsk?g     393216  end of media
       dsk?h     0         0

The disk label is located in block 0 (zero) in one of the first sectors of the disk. The disk label provides detailed information about the geometry of the disk and the partitions into which the disk is divided. The system disk driver and the boot program use the disk label information to recognize the drive, the disk partitions, and the file systems. Other information is used by the operating system to use the disk most efficiently and to locate important file system information.

The disk label description of each partition contains an identifier for the partition type (for example, standard file system, swap space, and so on). There are two copies of a disk label, one located on the disk and one located in system memory. Because it is faster to access system memory than to perform I/O, when a system recognizes a disk, it copies the disk label into memory. The file system updates the in-memory copy of the label if it contains incomplete information about the file system. You can change the label with the disklabel command. See disklabel(8) for more information on the command line interface. See the Hardware Management manual for information on the disk configuration utility diskconfig.

6.1.3    UFS Version 4.0

The version of UFS that is currently provided is at revision 4.0. This version has the same on-disk data layout as UFS Version 3.0, as described in Section 6.1.4 but has larger capacities.

Version 4.0 supports 65533 hard links or subdirectories while Version 3.0 supports 32767 hard links or subdirectories. The actual number of directories is 65531 (64k) and 32765 (32k), because the empty directory already has two hard links to itself and to its parent directory. When you use the ls -a command, these links are displayed as . and ... In the remainder of this section, the examples all refer to 32k subdirectories although the information also applies to files having 32k or more hard links.

There are some considerations and important restrictions that you should take into account, particularly when using both versions, as follows:

Using the newfs or diskconfig command to create file systems

When you create new file systems using newfs or diskconfig command, the new file systems always are created as Version 3.0 (32k subdirectories or hard links) to minimize any incompatibility problems.

Using the fsck command to verify file systems

When you use fsck to verify a dirty file system (such as one not unmounted normally, or perhaps after a system crash), the file system is marked as either Version 3.0 or Version 4.0, depending on the maximum number of subdirectories found. If the fsck command finds a directory with more than 32k subdirectories, the file system is marked as Version 4.0. Otherwise, if the fsck command does not find a directory with more than 32k hard links, the file system is marked as Version 3.0. A file system normally is converted to Version 4.0 as soon as the 32k subdirectory limit is exceeded by a user.

A new fsck option, -B, is added. This option enables you to convert Version 4.0 file systems back to Version 3.0. When you use this option, fsck make the conversion only if no directory in the file system has more than 32k subdirectories and no file has more than 32k hard links.

The following important restrictions apply when using both Version 3.0 and Version 4.0 of UFS on systems that are running previous versions of the operating system (such as V4.0F):

Automatic conversion from Version 3.0 to Version 4.0

As there are no on-disk data layout differences between the two releases of UFS, you can mount any legacy Version 3.0 file systems on the latest release of the operating system. If you attempt to create more than 32k hard links on a Version 3.0 file system, it is converted automatically to Version 4.0. The following example system message is displayed during conversion:

Marking /dev/disk/dsk023 as Tru64 UNIX UFS v.4

Manually converting file systems from Version 3.0 to Version 4.0

If you want to share or mount a Version 4.0 file system that does not have more than 32k subdirectories, you can mount it on a system that is running a previous version of the operating system that supports only Version 3.0, such as Tru64 UNIX Version 4.0F. However, you must first convert the file system from Version 4.0 as follows:

6.1.4    File System Structures: UFS

A UFS file system has four major parts:

These are described in the following sections.

The structure of the AdvFS file system is discussed in the AdvFS Administration manual.

6.1.4.1    Boot Block

The first block of every file system (block 0) is reserved for a boot, or initialization program.

6.1.4.2    Superblock

Block 1 of every file system is called the superblock and contains the following information:

6.1.4.3    Inode Blocks

A group of blocks follows the superblock. Each of these blocks contains a number of inodes. Each inode has an associated inumber. An inode describes an individual file in the file system. There is one inode for each file in the file system. File systems are subject to a limit on the number of inodes, which in turn controls the maximum number of files that a file system can contain. The maximum number of inodes depends on the size of the file system.

The first inode (inode 1) on each file system is unnamed and unused. The second inode (inode 2) must correspond to the root directory for the file system. All other files in the file system are under the file system's root directory. After inode 2, you can assign any inode to any file. You can also assign any data block to any file. The inodes and blocks are not allocated in any particular order.

If an inode is assigned to a file, the inode can contain the following information:

6.1.4.4    Data Blocks

Data blocks contain user data or system files.

6.1.5    Directories and File Types

The operating system views files as bit streams, allowing you to define and handle on-disk data, named pipes, UNIX domain sockets, and terminals as files. This object-type transparency provides a simple mechanism for defining and working with a wide variety of storage and communication facilities. The operating system handles the various levels of abstraction as it organizes and manages its internal activities.

While you notice only the external interface, you should understand the various file types recognized by the system. The system supports the following file types:

6.1.6    Device Special Files

Device special files represent physical devices, pseudodevices, and named pipes. The /dev directory contains device special files. Device special files serve as the link between the system and the device drivers. Each device special file corresponds to a physical device (for example, a disk, tape, printer, or terminal) or a pseudodevice (for example, a network interface, a named pipe, or a UNIX domain socket). The driver handles all read and write operations and follows the required protocols for the device.

There are three types of device special files:

For detailed information on device special files and their naming conventions, see the Hardware Management manual.

6.2    Context-Dependent Symbolic Links and Clusters

This section describes context-dependent symbolic links (CDSLs), a feature of the directory hierarchy that supports joining systems into clusters. CDSLs impose certain requirements on the file system and directory hierarchy of all systems, even those that are not members of a cluster. You should be aware of these requirements as follows:

See hier(5) for a description of the directory structure.

CDSLs enable systems joined together as members of a cluster to have a global namespace for all files and directories they need to share. CDSLs allow base components and layered applications to be cluster aware. Shared files and directories work equally well on a cluster and a single system and file system administration tools work identically both on a single system and in a cluster.

If CDSLs are important to you because your systems may become cluster members at some future date, you should read the following sections. If you encounter errors that refer to missing CDSLs (such as a failed update installation) you may need to maintain, verify, or repair CDSLs as described in the following sections.

6.2.1    Related Documentation

The following documents contain information about CDSLs:

6.2.2    Description of CDSLs

Individual systems can be connected into clusters that appear as one system to users. A single system in a cluster is called a member. (See the TruCluster documentation for a description of a Tru64 UNIX cluster.) To facilitate clustering, file systems must have a structure and identifying pathname that allows certain files to be unique to the individual cluster member and contain member-specific information.

Other files may need to be shared by all members of a cluster. The CDSL pathname allows the different systems in a cluster to share the same file hierarchy. Users and applications can use traditional pathnames to access files and directories whether they are shared or member-specific.

For example, if two systems are standalone or simply connected by a network link, each has an /etc/passwd file that contains information about its authorized users. When two systems are members of a cluster, they share a common /etc/passwd file that contains information about the authorized users for both systems.

Other shared files are:

Some files always must be member-specific; that is, not shared. The file/etc/rc.config is an example of a member-specific file while rc.config.common is a shared file. These files contain configuration information that either applies only to the individual system or to all members of a cluster. CDSLs allow clustered systems to share files and to maintain the identity of member-specific files. Other categories of member-specific files are:

When a system is not connected to a cluster the pathnames are still present, although they are transparent to users. You must be aware of the cluster file naming conventions, and must preserve the file structure. If a CDSL is accidentally removed, you may need to recreate it.

6.2.2.1    Structure of a CDSL

CDSLs are simply the symbolic links described in ln(1). The links contain a variable that identifies each system that is a cluster member. This variable is resolved at run time into a target. A CDSL is structured as follows:

/etc/rc.config -> /cluster/members/{memb}/etc/rc.config

Before support for clusters was introduced, the pathname for this file was /etc/rc.config. This file is now linked through a CDSL to a member-specific target, and the structure of the link can be interpreted as follows:

The file /.local.. in root is a link to cluster/members/{memb} and defines the system-specific files. Any system-specific file can be referenced or created through the /.local.. path. A file created as /.local../etc/[filename] is not accessible through the path /etc/[filename] because /etc is a shared directory. The file is only accessible through /.local../etc/[filename] and /cluster/members/{memb}/etc/[filename].

When a single system is not clustered with other systems, the variable generic:memberid is set to zero automatically. An example of a typical CDSL on a single system is:

/cluster/members/{memb}/etc/rc.config

This CDSL is resolved to:

/cluster/members/member0/etc/rc.config

When a system is clustered with two other systems and the variable generic:memberid is set to three, the same CDSL is resolved to:

/cluster/members/member3/etc/rc.config

When running in a cluster, a file that is member-specific can be referenced in the following three ways:

Two special cases of CDSLs exist only for members of a cluster:

See the TruCluster documentation for more information.

6.2.3    Maintaining CDSLs

Symbolically-linked files enjoy no special protection beyond the general user and file access mode protections afforded all files. CDSLs have no special protection either. On a single system, there are several situations that could cause it to fail when a CDSL has been broken:

6.2.3.1    Verifying CDSL Inventory

Use the script /usr/sbin/cdslinvchk to verifying the CDSL inventory on a single system. Periodically, revise the inventory and examine the CDSLs against it. See cdslinvchk(8) for more information.

6.2.3.2    Creating CDSLs

If a CDSL is accidentally destroyed, or if a new CDSL must be created, the process for repairing or creating links is described in ln(1). For example, if the /etc/rc.config link is destroyed, you create it as follows:

6.3    Creating UFS File Systems Manually

The basic file system configuration for your operating system is defined during installation, when your system's root file system is established. After installation, you can create file systems as your needs evolve. The following sections describe how you create file systems manually, at the command line. You must use command line operations on file systems when working at the console, when the system is in single-user mode and graphic utilities are unavailable.

For information on creating AdvFS file systems, see the AdvFS Administration manual.

6.3.1    Using newfs to Create a New File System

The typical procedure for creating a file system is as follows:

  1. Identify the disk device and the raw disk partition that you want to use for the new partition, ensuring that the partition is correctly labeled and formatted and is not in use already. Use the command line interfaces hwmgr and dsfmgr to identify devices or to add new devices and create the device special files. This procedure is described in the Hardware Management manual. See hwmgr(8) and dsfmgr(8) for information on the command options.

    If required, use the disklabel -p command to read the current partition status of the disks. Examine the /etc/fstab file to ensure that the partitions are not already allocated to file systems, or used as swap devices. See disklabel(8), and fstab(4) for more information.

  2. Having identified which unused raw (character) disk partition you use, you can determine the special device file name for the partition. For example, partition g on disk 2 has a special device file named /dev/rdisk/dsk2g. See the Hardware Management manual for information on device special file names.

  3. Use the newfs command to create a file system on the target partition. See newfs(8) for more information.

  4. Create a mount point directory, and use the mount command to mount the new file system, making it available for use. If you want the mount to persist across reboots, add a mount command to the /etc/fstab file. If you want to export the file system, add it to the /etc/exports file; see mount(8) for more information.

  5. Use the chmod command to verify and adjust any access control restrictions; see chmod(1) for more information.

These steps are described in more detail in the remainder of this section.

The newfs command formats a disk partition and creates a UFS file system. Using the information in the disk label or the default values specified in the /etc/disktab file, the newfs command builds a file system on the specified disk partition. You can use newfs command options to specify the disk geometry.

Note

Changing the default disk geometry values may make it impossible for the fsck program to find the alternate superblocks if the standard superblock is lost.

The newfs command has the following syntax:

/sbin/newfs [-N] [newfs_options] special_device [disk_type]

You must specify the unmounted, raw device (for example, /dev/rdisk/dsk0a).

See newfs(8) for information on the command options specific to file systems. This reference page also provides information on the mfs command, and describes how you create a memory file system (mfs).

The following example shows the creation of a new file system:

  1. Determine the target disk and partition. For most systems, your local administrative log book tells you which disk devices are attached to a system and which partitions are assigned. However, you may be faced with administering a system that could be in an unknown state; that is, devices may have been removed or added. Use the following commands and utilities to assist you in identifying a target disk and partition:

    1. Examine the contents of the /dev/disk directory. Each known disk device has a set of device special files for the partition layout. For example, /dev/disk/dsk1a to /dev/disk/dsk1h tells you that there is a device named dsk1.

    2. Devices may be available on the system, but without any device special files. Use the hwmgr command to examine all devices that are known to the system physically and visible on a bus. For example:

      # hwmgr -view devices -category disk
       HWID:            DSF Name    Model       Location
      -------------------------------------------------------
         15:  /dev/disk/floppy0c    3.5in         fdi0-unit-0
         17:     /dev/disk/dsk0c RZ1DF-CB  bus-0-targ-0-lun-0
         19:                     RZ1DF-CB  bus-0-targ-1-lun-0
         19:   /dev/disk/cdrom0c    RRD47  bus-0-targ-4-lun-0
      

      If a device is found for which no device special files exist, you can create the device special files using the dsfmgr utility.

      Note

      Normally, device special files are created automatically when a new disk device is added to the system. You only need to create them manually under the circumstances described in the Hardware Management manual.

    3. Having identified a device, use the disklabel command to determine what partitions may be in use as follows:

      # disklabel -r /dev/rdisk/dsk0a
      

      8 partitions:
      #       size  offset fstype [fsize bsize cpg] #NOTE: values not
                                                      exact
       a:   262144        0 4.2BSD 1024 8192  16  #(Cyl.   0 -78*)
       b:  1048576   262144   swap                #(Cyl.  78*-390*)
       c: 17773524        0 unused    0    0      #(Cyl.   0 -5289*)
       d:  1048576  1310720   swap                #(Cyl. 390*-702*)
       e:  9664482  2359296  AdvFS                #(Cyl. 702*-3578*)
       f:  5749746 12023778 unused    0    0      #(Cyl.3578*-5289*)
       g:  1433600   524288 unused    0    0      #(Cyl. 156*-582*)
       h: 15815636  1957888 unused    0    0      #(Cyl. 582*-5289*)
      

  2. From the disklabel command output, it appears that there are several unused partitions. However, you cannot use the c partition because it overlaps with the other partitions. Unless a custom disklabel has been created on the disk, only three possible tables of standard partitions are available for use, as shown in Table 6-1.

    Table 6-1:  Disk Partition Tables

    Partition Table Description
    c The entire disk is labeled as a single partition. Therefore, other partitions overlap c so you cannot use it.
    a b g h The disk is divided into four partitions. Partition a can be used as a boot partition. Partitions c, d, e, and f overlap so you cannot use them.
    a b d e f The disk is divided into five partitions. Partition a can be used as a boot partition. Partitions c, g, and h overlap so you cannot use them.

    The disk listed in the output from the disklabel command in step 1.c already uses partitions a, b, d, and e. Therefore it is labeled for five partitions, and the f partition is unused and available for use by the new file system.

    Note

    If a custom disk label has been applied to the disk and partitions are extended, you may not be able to use a partition even if it is designated as unused. In this case, the newfs command is not able to create the file system and returns an error message.

  3. Use the newfs command to create a file system on the target partition, as follows:

    # newfs /dev/rdisk/dsk0f
     
    Warning: 2574 sector(s) in last cylinder unallocated
    /dev/rdisk/dsk0f:  5749746 sectors in 1712 cylinders of \
    20 tracks, 168 sectors
       2807.5MB in 107 cyl groups (16 c/g, 26.25MB/g, 6336 i/g)
    super-block backups (for fsck -b #) at:
     32, 53968, 107904, 161840, 215776, 269712, 323648, 
    377584, 431520, 485456, 539392, 593328, 647264, 701200,
    755136, 809072, 863008, 916944, 970880, 1024816, 1078752,
    1132688, 1186624, 1240560,
    .
    .
    .
    

    The command output provides information on the size of the new file system and lists the super-block backups that are used by the file system checking utility fsck. See fsck(8) for more information.

  4. Mount the file system as described in the following sections.

6.3.2    Making File Systems Accessible to Users

You attach a file system to the file system hierarchy using the mount command, which makes the file system available for use. The mount command attaches the file system to an existing directory, which becomes the mount point for the file system.

Note

The operating system does not support 4-Kb block-size file systems. The default block size for file systems is 8 kilobytes. To access the data on a disk that has 4-Kb block-size file systems, you must back up the disk to either a tape or a disk that has 8-Kb block-size file systems.

When you boot the system, file systems that are defined in the /etc/fstab file are mounted. The /etc/fstab file contains entries that specify the device and partition where the file system is located, the mount point, and more information about the file system, such as file system type. If you are in single-user mode, the root file system is mounted read only.

If you should encounter a "dirty file system" error message when you try to mount the file system, you need to run the fsck command on that file system.

To change a file system's mount status, use the mount command with the -u option. This is useful if you try to reboot and the /etc/fstab file is unavailable.

If you try to reboot and the /etc/fstab file is corrupted, use a command similar to the following:

# mount -u /dev/disk/dsk0a /

The /dev/disk/dsk0a device is the root file system.

6.3.3    Using the /etc/fstab File

Either AdvFS or UFS can be the root file system, although AdvFS is used by default if you do not specify UFS during installation. If your system was supplied with a factory-installed operating system, the root file system is AdvFS. The operating system supports only one root file system from which it accesses the executable kernel ( /vmunix ) and other binaries and files that it needs to boot and initialize. The root file system is mounted at boot time and cannot be unmounted. Other file systems must be mounted, and the /etc/fstab file tells a booting system what file systems to mount and where to mount them.

The /etc/fstab file contains descriptive information about file systems and is read by commands such as the mount command. When you boot the system, the /etc/fstab file is read and the file systems described in the file are mounted in the order that they appear in the file. A file system is described on a single line; information on each line is separated by tabs or spaces.

The order of entries in the /etc/fstab file is important because the mount and umount commands read and act on the file entries in the order that they appear.

You must be root user to edit the /etc/fstab file. When you complete changes to the file and want to immediately apply the changes, use the mount -a command. Otherwise, any changes you make to the file become effective only when you reboot the system.

The following is an example of an /etc/fstab file:

/dev/disk/dsk2a   /                  ufs     rw      1    1
/dev/disk/dsk0g   /usr               ufs     rw      1    2
/dev/disk/dsk2g   /var               ufs     rw      1    2
/usr/man@tuscon   /usr/man           nfs     rw,bg   0    0
proj_dmn#testing  /projects/testing  advfs   rw      0    0
     [1]               [2]             [3]   [4]     [5]  [6]

Each line contains an entry and the information is separated either by tabs or spaces. An /etc/fstab file entry has the following information:

  1. Specifies the block special device or remote file system to be mounted. For UFS, the special file name is the block special file name, not the character special file name. For AdvFS, the special file name is a combination of the name of the file domain, a number sign (#), and the fileset name. [Return to example]

  2. Specifies the mount point for the file system or remote directory (for example, /usr/man) or /projects/testing. [Return to example]

  3. Specifies the type of file system, as follows:

    cdfs Specifies an ISO 9600 or HS formatted (CD-ROM) file system.
    nfs Specifies NFS.
    procfs Specifies a /proc file system, which is used for debugging.
    ufs Specifies a UFS file system or a swap partition.
    advfs Specifies an AdvFS file system.

    [Return to example]

  4. Describes the mount options associated with the partition. You can specify a list of options separated by commas. Usually, you specify the mount type and any additional options appropriate to the file system type, as follows:

    ro

    Specifies that the file system is mounted with read-only access.

    rw

    Specifies that the file system is mounted with read-write access.

    userquota groupquota

    Specifies that the file system is processed automatically by the quotacheck command and that file system quotas are enabled with the quotaon command.

    By default, user and group quotas for a file system are contained in the quota.user and quota.group files, which are located in the directory specified by the mount point. For example, the quotas for the file system on which /usr is mounted are located in the /usr directory. You also can specify another file name and location. For example: userquota=/var/quotas/tmp.user

    xx

    Specifies that the file system entry should be ignored.

    [Return to example]

  5. Used by the dump command to determine which UFS file systems should be backed up. If you specify the value 1, the file system is backed up. If you do not specify a value or if you specify 0 (zero), the file system is not backed up. [Return to example]

  6. This is the pass number and is used to control parallelism in the fsck (UFS) and quotacheck (UFS and AdvFS) utilities when processing all the entries in the /etc/fstab file. You can use this field to avoid saturating the system with too much I/O to the same I/O subsystem by controlling the sequence of file system verification during startup.

    If you do not specify a pass number or if you specify 0 (zero), the file system is not verified. All entries with a pass number of 1 are processed one at a time (no parallelism). For the root file system, always specify 1. Entries with a pass number of 2 or greater are processed in parallel based on the pass number assigned (with some exceptions). All entries with a pass number of 2 are processed before pass number 3, pass number 3 are processed before 4, and so on. The exceptions are multiple UFS file systems on separate partitions of the same disk or multiple AdvFS filesets in the same domain. These are processed one after the other if they all have the same pass number. All other file systems with the same pass number are processed in parallel. [Return to example]

See fstab(4) for more information about its fields and options.

Swap partitions are configured in the /etc/sysconfigtab file as shown in the following example:

        swapdevice=/dev/disk/dsk0b,/dev/disk/dsk0d
        vm-swap-eager=1

See the Hardware Management manual, Chapter 12, and swapon(8) for more information on swapping and swap partitions.

6.3.4    Mounting the UFS File System Manually

You use the mount command to make a file system available for use. Unless you add the file system to the /etc/fstab file, the mount is temporary and does not exist after you reboot the system.

The mount command supports the UFS, AdvFS, NFS, CDFS, and /proc file system types.

The following mount command syntax is for all file systems:

mount [- adflruv ] [-o option ] [-t type] [file_system ] [ mount_point ]

For AdvFS, the file system argument has the following form:

domain#fileset

Specify the file system and the mount point, which is the directory on which you want to mount the file system. The directory already must exist on your system. If you are mounting a remote file system, use one of the following syntaxes to specify the file system:

host:remote_directory
remote_directory@host

The following command lists the currently mounted file systems and the file system options.

# mount -l
/dev/disk/dsk2a on / type ufs (rw,exec,suid,dev,nosync,noquota)
/dev/disk/dsk0g on /usr type ufs (rw,exec,suid,dev,nosync,noquota)
/dev/disk/dsk2g on /var type ufs (rw,exec,suid,dev,nosync,noquota)
/dev/disk/dsk3c on /usr/users type ufs (rw,exec,suid,dev,nosync,noquota)
/usr/share/man@tuscon on /usr/share/man type nfs (rw,exec,suid,dev,
nosync,noquota,hard,intr,ac,cto,noconn,wsize=8192,rsize=8192,
timeo=10,retrans=10,acregmin=3,acregmax=60,acdirmin=30,acdirmax=60)
proj_dmn#testing on /alpha_src type advfs (rw,exec,suid,dev,nosync,noquota)
 

The following command mounts the /usr/homer file system located on host acton on the local /homer mount point with read-write access:

# mount -t nfs -o rw acton:/usr/homer /homer

See mount(8) for more information on general options and options specific to a file system type.

6.3.5    Unmounting the UFS File System Manually

Use the umount command to unmount a file system. You must unmount a file system if you want to do the following:

The umount command has the following syntax:

umount [- afv ] [- h host ] [- t type ] [ mount_point ]

If any user process (including a cd command) is in effect within the file system, you cannot unmount the file system. If the file system is in use when the command is invoked, the system returns the following error message and does not unmount the file system:

mount device busy

You cannot unmount the root file system with the umount command.

6.3.6    Extending the UFS File System

You can increase the capacity of a UFS file system up to the storage available on a single disk or Logical Storage Manager (LSM) volume. The process of increasing the capacity (or size) of a UFS file system is called extending the file system.

When the file system is on line (mounted) you can extend it by using mount command options. If preferred, you can perform this operation when the file system is off line (dismounted) by using the extendfs command. You can use this procedure as either a temporary or permanent solution if the system notifies you that a file system is full. File systems can be extended as frequently as required, up to the physical limits of the storage device.

You cannot reverse this procedure. The only way you can return a file system to its original volume is to back up the file system using the dump or a back up utility, and then restore the file system to an appropriately sized disk partition.

The prerequisites for extending a file system are as follows:

Identify file systems

Use the more command on the /etc/fstab file to identify file systems and the partitions on which they reside as follows:

# /usr/bin/more /etc/fstab
/dev/disk/dsk0a on / type ufs (rw)
/proc on /proc type procfs (rw)
.
.
.
/dev/disk/dsk15e on /databases type ufs (rw)
/dev/disk/dsk4g on /projects type ufs (rw)
 
 

Verify the file system back up status

This procedure is nondestructive, and designed so that you can perform it quickly when needed. However, you may want to back up important data files.

Determine the available disk storage capacity

A UFS file system exists on a single disk partition or LSM volume. To extend the file system, increase the disk space as follows:

For example, you have a disk that is currently used as follows:

In the preceding example, you can extend the UFS file system on the b partition by an additional 6 GB. You need not take the entire 6 GB in a single extension; you can stage the extension to conserve disk space.

If you do not have adequate disk capacity to extend the file system, back it up and restore it to as new disk volume as described in Chapter 9.

Reset the partition size

Use the disklabel command to reset the size of the partition on which the file system resides. The following procedure describes the use of the disklabel command.

Note

You cannot use the graphical disk configuration utility, diskconfig, to perform this operation because the diskconfig utility does not bypass the partition verification and disallows reconfiguration of any partitions that are in use.

  1. Save the current disk label to a file so that you can edit the partitions. For example:

    # /sbin/disklabel -r /dev/disk/dsk4 > d4label
     
     
    

  2. Edit the saved label to increase the capacity of the partition in use, decreasing the unused partition by an identical amount.


    .
    .
    .
    b: 10192000 1048576 4.2BSD 1024 8192 16 # (Cyl. 312*- 2750*) g: 7104147 8669377 unused 1024 8192 # (Cyl. 2580*- 5289*)

    For example, to increase the size of partition g by 3,000,000 blocks, change the label as follows:


    .
    .
    .
    b: 13192000 1048576 4.2BSD 1024 8192 16 # (Cyl. 312*- 2750*) g: 4104147 8669377 unused 1024 8192 # (Cyl. 2580*- 5289*)

    Save the disklabel file and exit from the editor.

  3. Write the label to the raw disk, specifying the edited file as follows:

    # /sbin/disklabel -R /dev/rdisk/dsk4 d4label
     
     
    

See disklabel(8) for more information.

After you create additional disk space, extend the file systems by using one of the methods described in the following sections.

6.3.6.1    Extending a Dismounted File System

Use the extendfs command to extend a file system that is off line and in use. You can extend the entire partition on a single operation, or extend the file system in stages. Use the extendfs command in either of the two following ways. These procedures assume that you completed the prerequisite step to increase the disk partition size, as described in Section 6.3.6.

6.3.6.2    Extending a Mounted File System

Use the mount command to extend a file system that is on line (mounted) and in use. This procedure assumes that you completed the prerequisite steps to identify the mounted partition and increase the disk partition size, as described in Section 6.3.6.

The syntax of the mount command is described in Section 6.3.4. To extend a file system, you use the extend option with the -o option and specify the mount point as follows:

#  /sbin/mount -u -o extend /projects
extending file system, please wait.

The mount command does not display any completion or error output for this operation. The length of time for completion depends on the size of the partition, and may take several minutes to complete. You should therefore verify the operation using the df command as follows:

#  /usr/bin/df /projects
 
 

The output from this command confirms if the operation was a success. If the operation was not a success, verify that the disk partition is correct and the mount point exists.

6.4    Administering UFS File Systems Using SysMan Menu

In addition to the manual method of file system creation and administration, the operating system provides some graphical tools, and also some SysMan Menu tasks, which you can use in different user environments. See Chapter 1 for information on invoking and using SysMan. If you are using the Common Desktop Environment, other graphical utilities are available. Access these from the CDE Application Manager main folder as follows:

  1. Select the Application Manager icon from the CDE front panel

  2. Select the System_Admin icon from the Application Manager folder window

  3. Select the Storage_Management icon from the Application Manager - System_Admin folder window

Depending on what options are installed and licensed on your system, the following icons may be available in this window:

Advanced File System

Select this icon to run the AdvFS graphical user interfaces. See the AdvFS Administration manual for more information.

See dtadvfs(8) for information on launching the Advfs graphical interface from the command line.

Bootable Tape

Select this icon to invoke the SysMan Menu Bootable Tape Creation interface. Use this interface to create a bootable system image on tape. This image contains a standalone kernel and copies of selected file systems that you specify during creation. You can recover the image using the btextract utility. See Chapter 9 for information on using the bootable tape interfaces. See btcreate(8), btextract(8), and bttape(8) for more information. The bttape command is used to launch the bootable tape graphical user interface from a command line or script.

File System Management

Select this icon to invoke the SysMan Storage utilities described in this section.

Logical Storage Manager (LSM)

Select this icon to invoke the LSM graphical user interface. Logical Storage Management enables you to create virtual disk volumes that appear as a single device to the system and any applications. See the Logical Storage Manager manual for more information and lsm(8) for a list of LSM commands.

To invoke this interface from the command line, use the lsmsa or dxlsm command. See lsmsa(8) for more information; the dxlsm is scheduled for retirement in a later release of the operating system.

Prestoserve I/O Accelerator

Select this icon to invoke the Prestoserve graphical utilities. Prestoserve stores synchronous disk writes in nonvolatile memory instead of writing them to disk. Then, the stored data is written to disk asynchronously as needed or when the machine is halted. See the Guide to Prestoserve manual for more information and presto(8) for information on the command line interface.

To invoke this interface from the command line, use the dxpresto command. See dxpresto(8) for more information.

The following sections describe the UFS file system utilities in the SysMan Menu.

6.4.1    File System Tasks in the SysMan Menu

The SysMan Menu contains a main menu option titled Storage. When expanded, these options appear as follows:

 - Storage
   - File Systems Management Utilities
      - General File System Utilities
             | Dismount a File System
             | Display Currently Mounted File Systems
             | Mount File Systems
             | Share Local Directory (/etc/exports)
             | Mount Network Directory (/etc/fstab)
         - Advanced File System (AdvFS) Utilities
             | Manage an AdvFS Domain
             | Manage an AdvFS File
             | Defragment an AdvFS Domain
             | Create a New AdvFS Domain
             | Create a New AdvFS Fileset
             | Recover Files from an AdvFS Domain
             | Repair an AdvFS Domain
          - UNIX File System (UFS) Utilities
             | Create a New UFS File System
          - Logical Storage Manager (LSM) Utilities
             | Initialize the Logical Storage Manager (LSM)
             | Logical Storage Manager
 
 
 

Each option provides a step-by-step interface to perform basic file system administrative tasks. See Chapter 1 for information on invoking and using the SysMan Menu. You can launch the file system utilities from the SysMan Station also. For example, if you are using the SysMan Station to display the Mounted_Filesystems view, you can press MB3 to do the following:

The SysMan Station Physical_Filesystems view provides a graphical view of file systems mapped to physical devices and enables you to perform tasks such as make AdvFS filesets on an existing domain. See Chapter 1 for information on invoking and using the SysMan Station. See the online help for information on using its file system options.

The following SysMan Menu Storage options are documented in other books:

Advanced File System (AdvFS) Utilities

See the AdvFS Administration manual.

Logical Storage Manager (LSM) Utilities

See the Logical Storage Manager manual.

The following sections describe the General File System Utilities and the UNIX File System (UFS) Utilities file system tasks available from the SysMan Menu. The typical procedure for creating a file system is exactly as described in Section 6.3, although the SysMan Menu tasks are not organized in the same sequence. These tasks are general-purpose utilities that you can use any time to create and administer file systems.

6.4.2    Using SysMan to Dismount a File System

To dismount a file system you need to specify its mount point, device special file name, or AdvFS domain name. You can obtain this information by using the more command to display the contents of the /etc/fstab file, or by using the SysMan Menu Storage option Display Currently Mounted File Systems described in Section 6.4.3. See mount(8) and umount(8) for the command line options.

The Dismount a File System option is available under the SysMan Menu Storage options. Expand the menu and select General File System Utilities if it is not displayed. When you select this option, a window titled Dismount a file system is displayed, prompting you to complete either of the following fields. You do not need to complete both fields:

  1. Mount point:

    Enter the mount point on which the file system is currently mounted, such as /mnt.

  2. File system name:

    Enter the device special file name for the mounted partition, such as /dev/disk/dsk0f, or an AdvFS domain name such as accounting_domain#act.

Select Apply to dismount the file system and continue dismounting other file systems, or select OK to dismount the file system and exit.

6.4.3    Using SysMan to Display Mounted File Systems

The option to display mounted file systems is available under the SysMan Menu Storage options. Expand the menu and select General File System Utilities - Display Currently Mounted File Systems. When you select this option, a window titled Currently Mounted File Systems is displayed, containing a list of the file systems similar to the following:

/dev/disk/dsk0a         /
/proc                   /proc
usr_domain#usr          /usr
usr_domain#var          /var
19serv:/share/19serv/tools/tools /tmp_mnt/19serv/tools
 
 

The following information is provided in the window:

File System

This can be one of the following:

19serv:/share/19serv/tools/tools   /tmp_mnt/19serv/tools
 
 

Mount Point

The directory on which the file system is mounted, such as /usr or /accounting_files.

The list can be extensive, depending on the number of currently mounted file systems. The list can provide information on current file-on-file mounts that may not be visible in the /etc/fstab file. Files in the /etc/fstab file that are not currently mounted are not included in this list.

The following options are available from the Currently Mounted File Systems window:

Details...

Use this option to display detailed file system data, otherwise known as the properties of the file system. You can obtain the following data from this option:

File system name: /dev/disk/dsk0a
Mount point:      /
File system size: 132 MBytes
Space used:       82 MBytes
Space available:  35 MBytes
Space used %:     70%

Dismount...

Use this option to dismount a selected file system, You are prompted to confirm the dismount request. You cannot dismount the file system if it is currently in use or even if a user has run the cd command to change directory to the file system that you want to dismount. Use the wall command if you want to ask users to stop using the file system.

Reload

Use this option to refresh the Currently Mounted File Systems list and update any dismounted file systems.

If you mount file systems using the command line, or if NFS mounts are established, these newly mounted systems are not displayed until you exit the utility and invoke it again.

OK

Select OK to exit the Currently Mounted File Systems window and return to the SysMan Menu.

6.4.4    Using SysMan to Mount File Systems

The operation of mounting a file system has the following prerequisites:

The option to mount a file system is available under the SysMan Menu Storage options. Expand the menu and select General File System Utilities - Mount File Systems to display the Mount Operation window. This interface provides an alternative to the mount command, described in mount(8). This utility operates only on the file systems currently listed in the /etc/fstab file. You can obtain information on the mounted file systems using the Display Mounted Filesystems SysMan Menu option, described in Section 6.4.3.

The Mount Operation window provides the following four exclusive selectable options:

  1. Mount a specific file system.

    Select this option to mount a single specific file system. The File System name and Mount Point window are displayed, prompting you to complete either of the following fields:

    Mount point:

    Type the mount point directory from the /etc/fstab file, such as /cdrom.

    File system name:

    Type a device special file name, such as /dev/disk/cdrom0c. Alternatively, type an AdvFS domain name, such as usr_domain#usr.

    The File System Mounting Options window are displayed next. This window is common to several of the mounting operations, and is described at the end of this list.

  2. Mount all file systems listed in /etc/fstab.

    Use this option to mount all file systems currently listed in the /etc/fstab file. Using the option assumes that all the specified partitions or domains are on line, and all the mount points have been created.

    The File System Mounting Options window are displayed next. This window is common to several of the mounting operations, and is described at the end of this list.

  3. As above, but only those of a specified type.

    Use this option to mount all file systems of a specified type listed in the /etc/fstab file. Using the option assumes that all the specified partitions or domains are on line, and all the mount points have been created.

    You specify the file system type in the File System Mounting Options window, which is displayed next. This window is common to several of the mounting operations, and is described at the end of this list. For example, you can choose to include only AdvFS file systems.

  4. Mount all file systems not of the selected type.

    Use this option to exclude from the mount operation, all file systems of a specified type listed in the /etc/fstab file. Using the option assumes that all the specified partitions or domains are on line, and all the mount points have been created.

    You specify the file system type to be excluded in the File System Mounting Options window, which is displayed next. This window is common to several of the mounting operations, and is described at the end of this list. For example, you can choose to exclude only UFS file systems.

The File System Mounting Options window is common to several of the preceding list of mount options, and enables you to specify additional optional characteristics for the mount operation. Some options may not be available, depending on the type of mount operation that you are attempting. The following options are available from this window:

Access Mode

Select the type of access that you want to enable:

Read/Write

Select this option to permit authorized users to read from and write to files in the file system.

Read only

Select this option to permit authorized users only to read from files in the file system, or to mount read-only media such as a CD-ROM volume.

File system type

From the menu, select one of the following options:

Unspecified

Select this option to allow any file system specification.

AdvFS

Select this option to specify an Advanced File System type. See the AdvFS Administration manual or advfs(4) for more information.

UFS

Select this option to specify a UNIX File System type. See Section 6.1.4 for a description of this file system.

NFS

Select this option to specify a Networked File System. See the Network Administration: Services manual and nfs(4) for more information.

CDFS

Select this option to specify a Compact Disk Read Only Memory File System. See cdfs(4) for more information.

Other

Select this option to enter your own file system choice in the Other file system type: field described in the next item.

Other file system type

Type the designation for the file system such as mfs for the memory file system (ram disk). See mount(8) for more information on supported file systems, and see the individual file system reference pages, such as newfs(8) for the memory file system.

Advanced Mount options

Type any advanced mount options that you want for the file system. For example, the dirty option, which allows a file system to be mounted even if it was not dismounted cleanly, such as after a system crash. See mount(8) for more information on the various options.

After you have entered the options you want, select Finish to process the mount operation and return to the SysMan Menu options. Select Back to return to the Mount Operation window and process new mount operations, or select Cancel to terminate the mount operation.

If data in any field is incomplete or incorrect, you are prompted to correct it before the mount operation can proceed.

6.4.5    Using SysMan to Share a Local Directory

File sharing involves adding file systems to the /etc/exports file so that users of other host systems can mount the shared directories by means of NFS (Network File System). If the Advanced Server for UNIX (ASU) is installed and running, you may have further options to share file systems with PC clients. See the ASU Concepts and Planning Guide.

You may need to enable network access to your system for remote hosts to mount the shared directories, such as by adding the hosts to the /etc/hosts file, setting up NFS, and running dxhosts. See the Network Administration: Services manual for information on configuring your system to allow incoming connections to shared file systems.

You can manage shared file systems using the dxfileshare graphical user interface, which you can launch from the command line or from the CDE Application Manager - DailyAdmin folder. See the File Sharing option in that folder. Online help is available for this interface. See dxfileshare(8) for more information on invoking the interface.

The only prerequisite for shared file systems is that you should have created disk file systems that are suitable for sharing as described in Section 6.3.1 (manual method) or Section 6.4.7 (using SysMan Menu options) already. You specify the shared file system by its directory pathname, such as /usr/users/share.

The file system sharing option is available under the SysMan Menu Storage branch as follows:

-Storage
   - File Systems Management Utilities
     - General File System Utilities
         | Share Local Directory (/etc/exports)

6.4.5.1    Sharing a File System

Follow these steps to share an existing file system:

  1. In the window titled Share Local Directory on hostname.xxx.yyy.xxx, any existing shares are listed in the first box, identified by the directory pathname.

    Select Add... to add a directory to the list. A window titled Share Local Directory: Add Local Directory opens.

  2. Enter the directory path name, such as /usr/users/share/tools, in the field labeled Share This Directory:.

  3. Choose whether to share the directory with read/write access or read-only access. Read/Write is selected by default.

  4. Choose whether to share the directory with all qualified hosts (remote systems) or only with named hosts as follows:

    All

    Select this to designate all hosts.

    Selected

    Select this to designate a list of certain hosts.

  5. If you selected Selected in the previous step, enter the host name and address, such as dplhst.xxx.yyy.com. The host must be known to your local host, either through the /etc/hosts file or through a domain name server (DNS). See the Network Administration: Services manual for more information.

  6. Select OK to validate the data and close the dialog box and return to the Share Local Directory on host name window.

    All changes are deferred until you select OK in this window.

    When you select OK, the directories are made available for sharing.

6.4.5.2    Removing a Shared File System

To remove a share, use the same utility as follows:

  1. Delete hosts from the access list.

  2. Modify access to shared file systems by changing the read/write permissions or removing selected hosts from the access list.

  3. Delete shared file systems from the shared list to prevent any access.

6.4.6    Using SysMan to Mount a Network File System

You can mount shared file systems that are shared (exported) by other hosts using the Network File System (NFS). Your local system (host) must be configured to import NFS-shared file systems, including authorized network access to remote hosts. Remote systems (hosts) must be configured to share or export file systems by specifying your system in their /etc/exports files. You can mount NFS-shared file systems in several ways:

Temporarily, where the mount does not persist across a reboot.

A mount point is created and the file system is connected for the current session. If the system is shut down for any reason, the mount point persists, but the file system connection is lost and is not reestablished when the system is booted.

Permanently, by specifying the shared NFS file systems in your local /etc/fstab file.

For example, your /etc/fstab file already may have one or more NFS file system entries similar to the following:

/usr/lib/toolbox@ntsv /usr/lib/toolbox nfs rw,bg,soft,nosuid 0 0
 

See Section 6.3.3 for a description of the structure of an /etc/fstab file.

Automatically on request from a user, using the NFS automount utility.

See the Network Administration: Services manual and automount(8) for information on using this option. Using automount enables local users to mount any file systems that are shared with (exported to) your local system transparently. You do not need to respond to mount requests from users constantly.

The information in this section enables you to add more NFS shares permanently to your /etc/fstab file or to create temporary imports of shared file systems.

See Section 6.4.5 for a description of the process of sharing (exporting) file systems using the SysMan Menu options.

You can manage shared file systems using the File Sharing graphical user interface (GUI), which you can launch from the command line, or from the CDE Application Manager - DailyAdmin folder. See the File Sharing option in that folder. Online help is available for this interface. See dxfileshare(8) for more information on invoking the interface.

6.4.6.1    Mounting a Shared Network File System

The option to mount NFS file systems is available under the SysMan Menu Storage options. Expand the menu and select General File System Utilities - Mount Network Directory (/etc/fstab). Follow these steps to mount a shared file system:

  1. In the window titled Mount Network Directory on hostname, there is a list of existing available NFS shared file systems listed in the /etc/fstab file, which provides you with the following information:

    Directory and Host

    The name of the host, and the directory it is exporting to your local system.

    Mounted On

    The local mount point on which the shared file system is mounted. This is a directory pathname, such as /tools/bin/imaging.

    Options

    The access options for the directory, which can be as follows:

    Read/Write

    Allows users to both read data from and write data to the shared file system. This may depend on the access conditions set by the exporting host.

    Read-Only

    Allows users only to read data from the shared file system.

    Reboot

    Indicates whether the mount is reestablished if the system is shut down for any reason, and can be as follows:

    true

    Permanent; the entry is in the local /etc/fstab file and the mount persists across reboots.

    false

    Temporary; the entry is not in the local /etc/fstab file and the mount does not persist.

6.4.6.2    Adding a Network Directory

Select Add.... to add a file system to the list of NFS-shared directories. A window titled Mount Network Directory: Add Network Directory is displayed.

When you use this option, file systems are mounted with the options hard (retries until a response is received) and bg (background mount) by default. See mount(8) for more information on these options.

6.4.7    Using SysMan to Create a UFS File System

Creating a UFS file system manually using the newfs command is described in Section 6.3.1 and the same prerequisites and sources of data apply to the process of creating a file system with the SysMan Menu options, except that you are limited to standard disk partitions. If you want to use custom partitions, use the diskconfig utility as described in the Hardware Management manual.

Obtain the following items of data before proceeding:

The option to create a new UFS file system is available under the SysMan Menu Storage options. Expand the menu and select UNIX File System (UFS) Utilities - Create a New UFS File System. A window titled Create a new UFS File System is displayed next.

Follow these steps to create a file system:

  1. Enter the name of the disk partition or the LSM volume that you selected to store the file system in the field labeled Partition or LSM Volume.

  2. Enter the name of the disk model, such as HB00931B93, in the field named Disk type.

  3. Enter any option flags, such as -b 64 for a 64 kilobyte block size, in the Advanced newfs options field.

    If you are unsure what options to use, clear all fields and select Apply. This displays a newfs information window, containing a list of flag options.

Select OK to create the file system and exit to the SysMan Menu or select Apply to create the file system and continue creating more file systems. To terminate the operation, select Cancel.

Use the SysMan Menu option Mount File Systems described in Section 6.4.4 to mount the newly created file systems.

6.5    Managing Quotas

The following sections describe user and group quotas for UFS. AdvFS also supports fileset quotas, which limit the amount of space a fileset can have. For information about AdvFS fileset quotas, see the AdvFS Administration manual, which also has AdvFS-specific information about user and group quotas.

As a system administrator, you establish usage limits for user accounts and for groups by setting quotas for the file systems they use. Thus, user and group quotas are known as file system quotas. The file system quotas are known as disk quotas because, when established, they limit the number of disk blocks used by a user account or a group of users.

You set quotas for user accounts and groups by file system. For example, a user account can be a member of several groups on a file system and also a member of other groups on other file systems. The file system quota for a user account is for a user account's files on that file system. A user account's quota is exceeded when the number of blocks (or inodes) used on that file system are exceeded.

Like user account quotas, a group's quota is exceeded when the number of blocks (or inodes) used on a particular file system is exceeded. However, the group blocks or inodes used only count toward a group's quota when the files that are produced are assigned the group ID (GID) for the group. Files that are written by the members of the group that are not assigned the GID of the group do not count toward the group quota.

Note

Quota commands display block sizes of 1024-bytes instead of the more common 512-byte size.

You can apply quotas to file systems to establish a limit on the number of blocks and inodes (or files) that a user account or a group of users can allocate. You can set a separate quota for each user or group of users on each file system. You may want to set quotas on file systems that contain home directories, such as /usr/users, because the sizes of these file systems can increase more significantly than other file systems. You should avoid setting quotas on the /tmp file system.

6.5.1    Hard and Soft Quota Limits

File system quotas can have both soft and hard quota limits. When a hard limit is reached, no more disk space allocations or file creations that would exceed the limit are allowed. A hard limit is one more unit (such as one more block, file, or inode) than would be allowed when the quota limit is active.

The quota is up to, but not including the limit. For example, if a hard limit of 10,000 disk blocks is set for each user account in a file system, an account reaches the hard limit when 9,999 disk blocks have been allocated. For a maximum of 10,000 complete blocks for the user account, the hard limit should be set to 10,001.

The soft limit may be reached for a period of time (called the grace period). If the soft limit is reached for an amount of time that exceeds the grace period, no more disk space allocations or file creations are allowed until enough disk space is freed or enough files are deleted to bring the disk space usage or number of files below the soft limit.

As an administrator, you should set the grace period large enough for users to finish current work and then delete files to get their quotas down below the limits you have set.

Caution

With both hard and soft limits, it is possible for a file to be partially written if the quota limit is reached when the write occurs. This can result in the loss of data unless the file is saved elsewhere or the process is stopped.

For example, if you are editing a file and exceed a quota limit, do not abort the editor or write the file because data may be lost. Instead, escape from the editor you are using, remove the files, and return to the session. You can write the file to another file system, remove files from the file system whose quota you reached, and then move the file back to that file system.

6.5.2    Activating File System Quotas

To activate file system quotas on UFS, perform the following steps.

  1. Configure the system to include the file system quota subsystem by editing the /sys/conf/NAME system configuration file to include the following line:

    options       QUOTA
    

  2. Edit the /etc/fstab file and change the fourth field of the file system's entry to read rw, userquota, and groupquota. See fstab(4) for more information.

  3. Use the quotacheck command to create a quota file where the quota subsystem stores current allocations and quota limits. See quotacheck(8) for command information.

  4. Use the edquota command to activate the quota editor and create a quota entry for each user.

    For each user or group you specify, edquota creates a temporary ASCII file that you edit with any text editor. Edit the file to include entries for each file system with quotas enforced, the soft and hard limits for blocks and inodes (or files), and the grace period.

    If you specify more than one user name or group name in the edquota command line, the edits affect each user or group. You can use prototypes that allow you to set up quotas for groups of users quickly, as described in Section 6.5.3.

  5. Use the quotaon command to activate the quota system. See quotaon(8) for more information.

  6. To verify and enable file system quotas during system startup, use the following command to set the file system quota configuration variable in the /etc/rc.config file:

    # /usr/sbin/rcmgr set QUOTA_CONFIG yes
    

    Note

    Setting QUOTQ_CONFIG to yes causes the quotacheck command to be run against the UFS file systems during startup. The AdvFS design does not need this service. While it is not recommended, you can force quotacheck to be run against both UFS and AdvFS file systems during system startup using the following command:

    # /usr/sbin/rcmgr set \
    QUOTACHECK_CONFIG -a
    

    To restore the default UFS-only quotacheck behavior, use the following command:

    # /usr/sbin/rcmgr set \
    QUOTACHECK_CONFIG ""
    

If you want to turn off quotas, use the quotaoff command. Also, the umount command turns off quotas before it unmounts a file system. See quotaoff(8) for more information.

6.5.3    Setting File System Quotas for User Accounts

To set a file system quota for a user, you can create a quota prototype or you can use an existing quota prototype and replicate it for the user. A quota prototype is an equivalent of an existing user's quotas to a prototype file, which is then used to generate identical user quotas for other users. Use the edquota command to create prototypes. If you do not have a quota prototype, create one by following these steps:

  1. Log in as root and use the edquota command with the following syntax:

    edquota proto-user users

    For example, to set up a quota prototype named large for user eddie, enter the following command:

    # edquota large eddie
    

    The program creates the large quota prototype for user eddie. You must use a real login name for the users argument.

  2. Edit the quota file opened by the edquota program to set quotas for each file system that user eddie can access.

To use an existing quota prototype for a user:

  1. Enter the edquota command with the following syntax:

    edquota -p proto-userusers

    For example, to set a file system quota for the user marcy, using the large prototype, enter:

    # edquota -p large marcy
    

  2. Confirm that the quotas are what you want to set for user marcy. If not, edit the quota file and set new quotas for each file system that user marcy can access.

6.5.4    Verifying File System Quotas

If you are enforcing user file system quotas, you should verify your quota system periodically. You can use the quotacheck, quota, and repquota commands to compare the established limits with actual use.

The quotacheck command verifies that the actual block use is consistent with established limits. You should run the quotacheck command twice: when quotas are first enabled on a file system (UFS and AdvFS) and after each reboot (UFS only). The command gives more accurate information when there is no activity on the system.

The quota command displays the actual block use for each user in a file system. Only the root user can execute the quota command.

The repquota command displays the actual disk use and quotas for the specified file system. For each user, the current number of files and the amount of space used (in kilobytes) is displayed along with any quotas.

If you find it necessary to change the established quotas, use the edquota command, which allows you to set or change the limits for each user.

See quotacheck(8), quota(1), and repquota(8) for more information on file system quotas.

6.6    Backing Up and Restoring File Systems

The principal backup and restore utilities for both AdvFS and UFS are the vdump and the vrestore utilities. These utilities are used for local operations on both AdvFS and UFS file systems. The utilities are described in vdump(8) and vrestore(8). For remote backup and restore operations on both AdvFS and UFS file systems, the utilities are rvdump and rvrestore.

For administrators who want to back up only UFS, the traditional utilities are described in dump(8) and restore(8).

Examples of backup and restore operations for AdvFS are described in the AdvFS Administration manual. Examples of backup and restore operations for UFS are described in Chapter 9, which also describes the process for creating a bootable tape. While this is not strictly a backup, it does provide a method of creating a bootable magnetic tape copy of the root file system and important system files from which you can boot the system and recover from a disaster such as a root disk crash.

Another archiving service is the Networker Save and Restore product, also described in Chapter 9.

6.7    Monitoring and Tuning File Systems

The following sections describe commands you use to display information about, and verify UFS file systems. They also include some basic information on file system tuning. For a more detailed discussion of tuning, see the System Configuration and Tuning manual.

6.7.1    Verifying UFS Consistency

The fsck program verifies UFS and performs some corrections to help ensure a reliable environment for file storage on disks. The fsck program can correct file system inconsistencies such as unreferenced inodes, missing blocks in the free list, or incorrect counts in the superblock.

File systems can become corrupted in many ways, such as improper shutdown procedures, hardware failures, power outages, and power surges. A file system can become corrupted if you physically write protect a mounted file system, take a mounted file system off line, or if you do not use the sync command before you shut the system down.

At boot time, the system runs fsck noninteractively, making any corrections that can be done safely. If it encounters an unexpected inconsistency, the fsck program exits, leaves the system in single-user mode, and displays a recommendation that you run the program manually, which allows you to respond yes or no to the prompts that fsck displays.

The command to invoke the fsck program has the following syntax:

/usr/sbin/fsck [options ...] [file_system ...]

If you do not specify a file system, all the file systems in the /etc/fstab file are verified. If you specify a file system, always use the raw device.

See fsck(8) for information about command options.

Note

To verify the root file system, you must be in single-user mode, and the file system must be mounted read only. To shut down the system to single-user mode use the shutdown command that is described in Chapter 2.

6.7.2    Monitoring File System Use of Disks

To ensure an adequate amount of free disk space, you should monitor the disk use of your configured file systems regularly. You can do this in any of the following ways:

You can use the quota command only if you are the root user.

6.7.2.1    Examinng for Available Free Space

To ensure sufficient space for your configured file systems, you should use the df command regularly to display the amount of free disk space in all the mounted file systems. The df command displays statistics about the amount of free disk space on a specified file system or on a file system that contains a specified file.

The df command has the following syntax:

df [- eiknPt ] [-F fstype ] [file ] [ file_system ...]

Without arguments or options, the df command displays the amount of free disk space on all the mounted file systems. For each file system, the df command reports the file system's configured size in 512-byte blocks, unless you specify the -k option, which reports the size in kilobyte blocks. The command displays the total amount of space, the amount presently used, the amount presently available (free), the percentage used, and the directory on which the file system is mounted.

For AdvFS file domains, the df command displays disk space usage information for each fileset.

If you specify a device that has no file systems mounted on it, df displays the information for the root file system.

You can specify a file pathname to display the amount of available disk space on the file system that contains the file.

You cannot use the df command with the block or character special device name to find free space on an unmounted file system. Instead, use the dumpfs command.

See df(1) for more information.

The following example displays disk space information about all the mounted file systems:

# /sbin/df 
Filesystem         512-blks   used  avail capacity Mounted on
/dev/disk/dsk2a      30686  21438   6178    77%   /
/dev/disk/dsk0g     549328 378778 115616    76%   /usr
/dev/disk/dsk2      101372   5376  85858     5%   /var
/dev/disk/dsk3      394796     12 355304     0%   /usr/users
/usr/share/man@tsts 557614 449234  52620    89%   /usr/share/man
domain#usr          838432 680320  158112   81%   /usr

Note

The newfs command reserves a percentage of the file system disk space for allocation and block layout. This can cause the df command to report that a file system is using more than 100 percent of its capacity. You can change this percentage by using the tunefs command with the -minfree flag.

6.7.2.2    Verifying Disk Use

If you determine that a file system has insufficient space available, examine how its space is being used. You can do this with the du command or the quot command.

The du command pinpoints disk space allocation by directory. With this information you can decide who is using the most space and who should free up disk space.

The du command has the following syntax:

/usr/bin/du [- aklrsx ] [ directory ... filename ...]

The du command displays the number of blocks contained in all directories (listed recursively) within each specified directory, file name, or (if none are specified) the current working directory. The block count includes the indirect blocks of each file in 1-kilobyte units, independent of the cluster size used by the system.

If you do not specify any options, an entry is generated only for each directory. See du(1) for more information on command options.

The following example displays a summary of blocks that all main subdirectories in the /usr/users directory use:

# /usr/bin/du -s /usr/users/*  
440     /usr/users/barnam
43      /usr/users/broland
747     /usr/users/frome
6804    /usr/users/norse
11183   /usr/users/rubin
2274    /usr/users/somer

From this information, you can determine that user rubin is using the most disk space.

The following example displays the space that each file and subdirectory in the /usr/users/rubin/online directory uses:

# /usr/bin/du -a /usr/users/rubin/online 
1	/usr/users/rubin/online/inof/license
2	/usr/users/rubin/online/inof
7	/usr/users/rubin/online/TOC_ft1
16	/usr/users/rubin/online/build
  .
  .
  .
251	/usr/users/rubin/online

As an alternative to the du command, you can use the ls -s command to obtain the size and usage of files. Do not use the ls -l command to obtain usage information; ls -l displays only file sizes.

You can use the quot command to list the number of blocks in the named file system currently owned by each user. You must be root user to use the quot command.

The quot command has the following syntax:

/usr/sbin/quot [-c] [-f] [-n] [file_system]

The following example displays the number of blocks used by each user and the number of files owned by each user in the /dev/disk/dsk0h file system:

# /usr/sbin/quot -f /dev/disk/dsk0h 

The character device special file must be used to return the information for UFS files, because when the device is mounted the block special device file is busy.

See quot(8) for more information.

6.7.3    Improving UFS read Efficiency

To enhance the efficiency of UFS reads, use the tunefs command to change a file system's dynamic parameters, which affect layout policies.

The tunefs command has the following syntax:

tunefs [- a maxc ] [- d rotd ] [- e maxb ] [- m minf ] [- o op t] [ file_s ]

You can use the tunefs command on both mounted and unmounted file systems; however, changes are applied only if you use the command on unmounted file systems. If you specify the root file system, you must reboot to apply the changes.

You can use command options to specify the dynamic parameters that affect the disk partition layout policies. See tunefs(8) for more information on the command options and sys_attrs_ufs(5) for information on UFS subsystem attributes.

6.8    Troubleshooting File Systems

Use the following tools to help you resolve problems associated with UFS file systems: