Parts of a UFS File System

UFS is the default disk-based file system used in the Solaris system software. It provides the following features:

  • State flags. These show the state of the file system as clean, stable, active, or unknown. These flags eliminate unnecessary file system checks. If the file system is clean or stable, fsck (file system check) is not run when the system boots.

  • Extended fundamental types (EFT). These include a 32-bit user ID (UID), a group ID (GID), and device numbers.

  • Large file systems. A UFS file system can be as large as 1 terabyte (TB) and can have regular files up to 2 gigabytes (GB). By default, the Solaris system software does not provide striping, which is required to make a logical slice large enough for a 1TB file system. However, the Solaris volume manager product described in Chapter 11 provides this capability.

  • By default, a UFS file system can have regular files larger than 2GB. You must explicitly use the nolargefiles mount option to enforce a 2GB maximum file size limit.

During the installation of the Solaris software, several UFS file systems are created on the system disk. These are Sun’s default file systems. Their contents are described in Table 14.1.

Table 14.1. Solaris Default File Systems
Slice File System Description
0 root Root (/) is the top of the hierarchical file tree. It holds files and directories that make up the operating system. The root directory contains the directories and files critical for system operation, such as the kernel, the device drivers, and the programs used to boot the system. It also contains the mount point directories, in which local and remote file systems can be attached to the file tree. The root (/) file system is always in slice 0.
1 swap Provides virtual memory or swap space. Swap space is used when you’re running programs too large to fit in the computer’s memory. The Solaris operating environment then “swaps” programs from memory to the disk and back, as needed. Although it is not technically required, it is common for the swap slice to be located in slice 1 unless /var is set up as a file system. If /var is set up, it uses slice 1, and swap is usually put on slice 4. The /var file system is for files and directories likely to change or grow over the life of the local system. These include system logs, vi and ex backup files, printer spool files, and UUCP files. On a server, it’s a good idea to have these files in a separate file system.
2 Entire Disk Refers to the entire disk and is defined automatically by Sun’s format utility and the Solaris installation programs. The size of this slice should not be changed.
3 /export Holds alternative versions of the operating system. These alternative versions are required by client systems whose architectures differ from that of the server. Clients with the same architecture type as the server obtain executables from the /usr file system, usually slice 6. /export is also where user home directories or file systems are located that will be shared across the network. This is discussed in more detail in Chapter 22.
4 /export/swap Provides virtual memory space for client systems.
5 /opt Holds additional Sun software packages, such as AdminSuite and optional third-party software that has been added to a system. If a slice is not allocated for this file system during installation, the /opt directory is put in slice 0, the root (/) file system.
6 /usr Holds operating system commands—also known as executables—designed to be run by users. This slice also holds documentation, system programs (init and syslogd, for example), and library routines. The /usr file system also includes system files and directories that can be shared with other users. Files that can be used on all types of systems (such as man pages) are in /usr/share.
7 /home Holds files created by users (also named /export/home). On a standard system, /home is a mount point that AutoFS manages. See Chapter 22 for more information.

Note

When using Web Start to install the operating system, the swap partition is placed at the start of the disk in partition 0 and the root partition is placed in slice 1. A marginal performance increase is achieved by putting swap at the starting cylinder because of the faster rotation speeds on the outside perimeter of the disk. Web Start is described in Chapter 9, “System Startup and Shutdown.”


You need to create (or re-create) a UFS file system only when you do the following:

  • Add or replace disks.

  • Change the slices of an existing disk.

  • Do a full restore on a file system.

  • Change the parameters of a file system, such as block size or free space.

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

  • Boot block Stores information used when booting the system

  • Superblock Stores much of the information about the file system

  • I-node Stores all information about a file except its name

  • Storage or data block Stores data for each file

The Boot Block

The boot block stores the procedures used in booting the system. Without a boot block, the system does not boot. If a file system is not to be used for booting, the boot block is left blank. The boot block appears only in the first cylinder group (cylinder group 0) and is the first 8KB in a slice.

The Superblock

The superblock stores much of the information about the file system. Following are a few of the more important items contained in a superblock:

  • Size and status of the file system

  • Label (file system name and volume name)

  • Size of the file system’s logical block

  • Date and time of the last update

  • Cylinder group size

  • Number of data blocks in a cylinder group

  • Summary data block

  • File system state (clean, stable, or active)

  • Pathname of the last mount point

Without a superblock, the file system becomes unreadable. The superblock is located at the beginning of the disk slice and is replicated in each cylinder group. Because it contains critical data, multiple superblocks are made when the file system is created.

A copy of the superblock for each file system is kept up-to-date in memory. If the system gets halted before a disk copy of the superblock gets updated, the most recent changes are lost and the file system becomes inconsistent. The sync command forces every superblock in memory to write its data to disk. The file system check program fsck can fix problems that occur when the sync command hasn’t been used before a shutdown.

A summary information block is kept with the superblock. It is not replicated but is grouped with the first superblock, usually in cylinder group 0. The summary block records changes that take place as the file system is used, listing the number of I-nodes, directories, fragments, and storage blocks within the file system.

The I-node

An I-node contains all the information about a file except its name, which is kept in a directory. An I-node is 128 bytes. The I-node information is kept in the cylinder information block and contains the following:

  • The type of the file (regular, directory, block special, character special, link, and so on)

  • The mode of the file (the set of read/write/execute permissions)

  • The number of hard links to the file

  • The UID of the file’s owner

  • The GID to which the file belongs

  • The number of bytes in the file

  • An array of 15 disk-block addresses

  • The date and time the file was last accessed

  • The date and time the file was last modified

  • The date and time the file was created

The maximum number of files per UFS file system is determined by the number of I-nodes allocated for a file system. The number of I-nodes depends on the amount of disk space that is allocated for each I-node and the total size of the file system. By default, one I-node is allocated for each 2KB of data space. You can change the default allocation by using the -i option of the newfs command. The newfs command is described later in this chapter.

The Storage Block

Storage blocks, also called data blocks, occupy the rest of the space allocated to the file system. The size of these storage blocks is determined at the time a file system is created. Storage blocks are allocated, by default, in two sizes: an 8KB logical block size and a 1KB fragmentation size.

For a regular file, the storage blocks contain the contents of the file. For a directory, the storage blocks contain entries that give the I-node number and the filename of the files in the directory.

Free Blocks

Blocks not currently being used as I-nodes, indirect address blocks, or storage blocks are marked as free in the cylinder group map. This map also keeps track of fragments to prevent fragmentation from degrading disk performance.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset