Chapter 6


File System Management

6.1 DISK MONITORING

SUPER-UX does not allow expansion of a file system size. This can cause insufficient disk space in a file system, although other file systems may have free space. When disk space is insufficient, the system administrator can examine disk space and file system use.

The following tasks should be done to investigate disk use.

Home


6.2 FILE SYSTEM REPAIR

The fsstat(1M), fsck(1M), and fsdb(1M) commands check and repair file systems. fsstat returns a code for each file system and indicates whether the fsck program, which provides consistency checking and repair, should be run. fsdb displays the contents of the file system and forces a change of data in the file system.

6.2.1 The fsck Command

The fsck command checks and repairs inconsistencies in a file system. Except for the root file system, a file system should be unmounted while it is being checked. The root file system should be checked only when the computer is in single-user mode and no other activity is taking place on the computer.

When the virtual volume has a reallocation attribute, fsck invokes alcck(1M) to check it. When the file system is SFS/H, fsck invokes hfsck(1M).

The following is the format of the fsck command:

Table 6-1 describes the fsck command options.

Table 6-1 fsck(1M) Command Options

OptionDescription
-y Specifies a "yes" response for all questions. This is the normal choice when the command is run as part of a shell procedure. It causes fsck to try to correct all errors.
-n Specifies a "no" response for all questions. fsck does not write the file system.
-b Reboot the system if the file system being checked is the root (/) file system and changes have been made by fsck. If only minor fixable damage is found, the system is remounted.
-s Specifies an unconditional reconstruction of the free list. Following reconstruction, reboot the system so that in-core copy of the superblock is updated (see the -b option).
-S Specifies a conditional reconstruction of the free list, which is to be done only if corruption is detected.
-tfile Specifies a scratch file to be used if the file system check requires additional memory. If this option is not specified, the process asks for a file name when more memory is needed.
-q Specifies a "quiet" file system check. Output messages from the process are suppressed.
-D Checks directories for bad blocks. This option is used to check file systems for damage after a system crash.
-f Specifies that a fast file system check be done. Only Phase 1 (check blocks and size) and Phase 5 (check free list) are executed for a fast check. Phase 6 (reconstruct free list) is run only if necessary.
-e Does not say "OKAY" in the state field in the superblock if an error could not be repaired successfully.
-o Omits alcck(1M) and hfsck(1M). If this option is omitted, alcck(1M) and hfsck(1M) are invoked as necessary.
-m Continues checking of the file system even if the MAGIC number on the superblock is wrong. If this option is not specified and the MAGIC number is wrong, fsck does not check the file system.
fsdevice Names the special device file associated with a file system. If no device name is specified, fsck checks all file systems named in /etc/checklist.

Home


The following examples show fsck checking the root file system and the user file system. No options are specified. The system response means that no inconsistencies were detected. The command operates in phases, some of which are run only if required or in response to a command line option. As each phase is completed, a message is displayed. At the end of the program a summary message is displayed showing the number of files (inodes), blocks, and free clusters.

Example 1:

Home


Example 2:

This section reviews the components of the SFS and describes the consistency checks applied to them.

Home


Home


NOTE

A bad cluster number in a file system is not the same as a bad (unreadable) cluster on a hard disk.

Home


Home


6.2.2 The fsdb Command

fsdb is a file system debugger used to repair the file system. fsdb changes the contents of specified addresses to specified values. Therefore, fsdb can repair a file system that fsck cannot.

fsdb is fully described in the SUPER-UX System Administrator's Reference Manual. This section describes the essential aspects of fsdb.

The format of the fsdb command is as follows:

special is the name of a special device file for the file system.

fsdb recognizes certain symbols and maintains a value called the current address, which points to a certain position in the file system. All displays and changes to data are made at this current address.

The main functions of fsdb are as follows:

6.2.2.1 LOCATE THE CURRENT ADDRESS

The operators and symbols shown in Table 6-2 can be used to change the current address. Numbers are considered decimal by default. Octal numbers must be prefixed with a zero.

Table 6-2 Current Operators and Symbols

SymbolDescription
number fsdb treats the number as the absolute byte address of the file system.
[number]b fsdb treats the number as a block number of the file system. If the number is omitted, the content in the current address is treated as the block number.
[number]C fsdb treats the number as a cluster number of the file system. If the number is omitted, the content in the current address is treated as the cluster number.
[number]i fsdb treats the number as an inode number. That inode is located and the current address is set to the top of this inode. If the number is omitted, the same number as the current location is assumed.
+[number] fsdb adds a specified number to the current address (or inode). The base of number is the present data type.
-[number] fsdb subtracts a specified number from current address (or inode). The base of number is the present data type.
Carriage return fsdb advances the current address in the data type (word, inode, directory entry) and displays the content of current.
mnemonic fsdb locates the current address on a specified mnemonic of inode or directory entry.

The results of some commands, such as displaying the contents of the current address, cause the current address to be changed to the address just beyond the end of the object displayed. For example, when fsdb displays a block's contents as short words (2 bytes), the current address points to the block's last 2 bytes.

Home


6.2.2.2 DISPLAY CURRENT CONTENTS

The p and f options display the contents of the current address. The display format is specified as described in Table 6-3.

Table 6-3 Current Print Options for Display Format

OptionDescription
p[number] Prints the contents after the current address for the specified format option number. For example, p4o prints four words (8 bytes) of data at the current address. The base of the number is different according to the option. If the number is 0, the contents of one block that contains the current address are printed. If the number is not specified, it is 1.
f[number] Prints the data cluster contents associated with the current inode. number indicates the current inode's logical cluster number. If number is not specified, fsdb regards it as 0. One cluster contents is printed in the specified format.

Home


Table 6-4 describes the print options.

Table 6-4 Current Print Options

OptionDescription
iPrint as inodes. It is necessary to locate the current address in the inode list block.
dPrint as a directory entry. It is necessary to locate the current address in the data cluster associated with the directory inode.
oPrint as octal short words (2 bytes).
ePrint as decimal short words (2 bytes).
cPrint as characters (1 byte).
bPrint as octal bytes (1 byte).
6.2.2.3 CHANGE CURRENT CONTENTS

The user can change the contents of the current address using equal-sign operators. The denominations depend on the present data type. A number is decimal by default. Octal numbers must be prefixed with a zero.

Table 6-5 describes the equal-sign operators that affect a current's content.

Table 6-5 Equal-Sign Operators for Current Content

OperatorDescription
=number Assign number to current's location.
=+number Increments number at current address to number.
=-number Decrements number at current address to number.
="string Assign string to current's location.
6.2.2.4 MISCELLANEOUS fsdb FUNCTIONS

Miscellaneous fsdb functions are described in the following paragraphs.

Home


Initially, the data type is a short word. Print options change the data type. The user can also change the data type using the symbols in Table 6-6.
Table 6-6 Symbols that Change Data Types of fsdb

SymbolDescription
B Change to byte mode
W Change to word (short word) mode
D Change to double (long word) mode
L Change to long (long word) mode

Table 6-7 Symbols that Show Directory Entry Fields

SymbolDescription
d numberThe current address is located in the directory entry that is in the specified slot number, and the directory entry contents are displayed.
nm The name of the directory entry.

Table 6-8 Symbols that Show Inode Fields

SymbolDescription
md Mode
ln Link count
uid User ID
gid Group ID
sz File size
a# Data block number
at File access time
mt File modification time
ct Inode modification time
maj Major device number
min Minor device number

Table 6-9 Current Save and Restore Symbols

SymbolDescription
> Save the current.
< Restore the current that was last saved.

Home


6.3 RESOURCE MANAGEMENT

The BSD disk quota system can be used as a resource management system for file use. In this system, every user is validated for file system use capacity. For details, see the SUPER-UX System Administrator's Guide.

6.4 AUTOMATIC FILE SYSTEM MOUNTING

During SUPER-UX system booting, local file systems can be checked and mounted automatically. To check and mount file systems automatically, the file system names must be entered in the /etc/fstab file. For details on the fstab file format, see fstab(4).

The rc2 procedure executes the automatic file system check and mount. rc2 executes S01MOUNTFSYS in the /etc/rc2.d directory, which is linked to MOUNTFSYS in the /etc/init.d directory.

The root file system is checked in the /etc/bcheckrc procedure, which is executed during system initialization. In the /etc/bcheckrc procedure, the fsstat command checks the root file system. If fsstat returns an error, fsck checks and repairs the root file system.

Home


6.5 DATA WRITING CONSISTENCY

System buffers are used to shorten the response time of a delayed write. Data written into the system buffers is not written to disk immediately. As a result, data in the system buffers can be lost before it is written if the system fails.

To prevent this problem, the write-on-close function of SFS can be used.

This function writes the following information to disk during close processing:

When a program repeatedly opens and closes files, the cost of this feature can be high. To help control this cost, three modes can be selected. The write-on-close mode can be specified for each file system with the mount command. The write-on-close function has the following three modes:

Table 6-10 shows the data written in each mode during the closing of a file.

Table 6-10 Write Data Dependent on Write-on-Close Function

Write ProcessSynchronous Write ModeAsynchronous Write ModeDelayed Write Mode
Superblock Synchronous write on closing each processAsynchronous write on closing all processesOn the activation of a sync daemon
Inode Synchronous write on closing each processAsynchronous write on closing all processDelayed write
File data Asynchronous write on closing each processAsynchronous write on closing all processesDelayed write

The delayed write mode does not perform writes when a file is closed. As such, the closed file data may not be written to disk. However, if a file is frequently opened or closed, this mode is the fastest.

The asynchronous write mode performs writes when a file is closed and no other processes have that file open.

After the last process that opened the file performs the close process, the write to disk is carried out. However, the close process does not wait for the disk writing process to terminate. Therefore, all data writing processes may not have ended when the close process terminates.

Whenever a process that has opened a file is performing the close process, the synchronous write mode carries out the write to disk. For synchronous write mode, the writing of the superblock and inode terminates when the close process ends. However, the writing of the file data may not end when the close process terminates. Although data consistency in synchronous write mode is high, the overhead for the write-on-close process needs to be considered. Files are repeatedly opened and closed.

The write-on-close function mode can be specified during the file system mount. For details on the mount command write-on-close specification, see the SUPER-UX System Administrator's Reference Manual.

Home


6.6 sync DAEMON

The sync daemon periodically writes system buffer data and file system information to disk. This daemon is created automatically when booting the system. The sync daemon writes the following information to disk:

The BDFLUSHR system parameter defines the interval between daemon start-ups. This value can be changed by the config command.

6.7 IAS MANAGEMENT

The management and maintenance of the Intelligent I/O Accelerator Subsystem (IAS) are handled by the devinfo command and the cache daemon.

6.7.1 devinfo Command

The devinfo(1M) command obtains system status information, which can be used to manage and maintain virtual volumes.

devinfo provides information about read/write performance, the cache control facility and the reallocation facility.

For further information, see Section 4.9.3.

6.7.2 cache Daemon

The data written into MMU is immediately transferred to disk or XM cache. Writing data in the XM cache to disk is delayed. The cache daemon updates the disks asynchronously.

The BDFLUSHR system parameter defines the cache daemon start-up interval. This value can be changed by the config command.

Home


6.8 BACKUP AND RESTORE

Backup is one of the most important and crucial administration functions. The SUPER-UX operating system provides commands to backup and restore disk data at the following levels:

This section describes the method of backup and restore for each object.

6.8.1 File System Backup/Restore

The SUPER-UX operating system supports dump(1M), restore(1M), and 4.3 Berkeley commands, for full file system backup/restore and incremental file system backup/restore.

The dump command provides a system of levels, ranging from 0 to 9. Using the levels, you can specify either a full backup or an incremental backup. When a level 0 dump is specified, dump does a full backup. When you specify a level 1-9 to dump, it does incremental backup (backs up only files that changed since the last dump of a lower level). For example, if you did a "level 2" dump on Monday, followed by a "level 4" dump on Tuesday, a subsequent "level 3" dump on Wednesday would contain all files modified or added since the "level 2" (Monday) backup.

Table 6-11 gives an example backup strategy.

Table 6-11 Backup Strategies 1

DateLevel
First day of month 0
From Monday to Thursday9
Friday5

If you use a strategy similar to that shown in Table 6-11 on Friday, files changed since the previous lower level dump (in this case the level 0 dump at the first day of the month) are copied to backup volumes. From Monday to Thursday, all files changed that week (since the level 5 dump was done the previous Friday) are copied. So, if the file system is damaged, you can recover from three different backup volumes. The fourth Friday's dump must save many files.

Table 6-12 Backup Strategies 2

DateLevel
First day of month0
From Monday to Thursday9
First Friday2
Second Friday3
Third Friday4
Fourth Friday5

If you use a strategy similar to that shown in Table 6-12 on Friday, all files changed that week (since the previous lower level dump -- last Friday's dump) are saved. This method reduces the size of the Friday dumps. If the file system is damaged after the fourth Friday dump but before the next level 0 dump, the six restore operations are required: the level 0 dump volume, the level 2 through 5 dumps, and the daily dump volume.

NOTE

It is desirable that the dumped file system is unmounted while the dump is executed. If the files in the file system are modified during the dump, the dump command sometimes detects an error or unfortunately aborts.

You can use the restore(1M) command to recover files from backup volumes created with the dump(1M) command.

Home


The following are some examples of dump(1M) and restore(1M) uses.

In addition to dump(1M)/restore(1M), SUPER-UX provides the volcopy(1M) command for full backup.

6.8.2 Backup/Restore Files and Directories

You can use tar(1) or cpio(1) to back up particular files used in system administration, such as account files and user home directories. This section shows an example of the tar(1) command use, which copies some files and directories to the tape controller.

Example 1 -- copying all the files in directory "dir1" to tape:

Example 2 -- recovering files and directories from tape to current directory:

See the SUPER-UX System Administrator's Reference Manual and the SUPER-UX User's Reference Manual for details of each command.

6.9 CACHE TROUBLE

During system operation, if trouble occurs in XM cache, I/O requests to the virtual volume can result in undefined errors. Therefore, if XM cache trouble occurs, the latest data is lost and data inconsistency occurs. If this happens, immediately unmount the entire virtual volume and reboot the system. In the worst case, normal shutdown may not be possible. In this case, forced rebooting of the system is necessary.

Home


6.10 MANAGING THE SFS/H FILE SYSTEM

6.10.1 Checking the SFS/H File System

The fsck(1M) command internally calls and executes hfsck(1M) to check the SFS/H file system.

hfsck(1M) is used to check the consistency of the SFS/H file system and eliminate conflicts. hfsck(1M) alone cannot check all items. hfsck(1M) operates in cooperation with fsck(1M). In general, execute fsck(1M) rather than directly executing hfsck(1M).

When the SFS/H file system is consistent, the number of hybrid files, the number of clusters used in the data section, and the number of free clusters are reported. If the file system is inconsistent, it is corrected automatically after prompting the user. In most cases, data is lost to some extent when the file system is corrected.

Example -- executing fsck for the SFS/H file system:

Home


6.10.2 Notes on Using SFS/H

The following restrictions apply to I/O requests for hybrid files created in the SFS/H file system. If any one of the following is not satisfied, I/O performance may deteriorate.

Data in the area that is allocated by lseek(2)/llseek(2) without writing becomes undefined. Similarly, data in the area that is preallocated by fcntl(2) becomes undefined.

The major feature of SFS/H is to make use of the maximum performance of each device by issuing I/O requests based on the cylinder boundary of the device. In order to make this possible, the following points must be noted.

6.10.2.1 FILE SIZE

Only up to 1546 clusters can be allocated to one hybrid file. For this reason, when 1080 KB are specified in H-DCLST, the maximum size of the hybrid file is calculated from the following expression:

Keep this in mind when setting the cluster size of the data section.

6.10.2.2 OTHERS

Home

Contents Previous Chapter Next Chapter Index