[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

System Management Guide:
Operating System and Devices

File Systems Troubleshooting Tasks

The topics in this section provide diagnostics and recovery procedures to use if you encounter one of the following:

Fix Disk Overflows

A disk overflow occurs when too many files fill up the allotted space. This can be caused by a runaway process that creates many unnecessary files. You can use the following procedures to correct the problem:

Note
You must have root user authority to remove processes other than your own.

Identify Problem Processes

Use the following procedure to isolate problem processes.

  1. To check the process status and identify processes that might be causing the problem, type:
    ps -ef | pg 

    The ps command shows the process status. The -e flag writes information about all processes (except kernel processes), and the -f flag generates a full listing of processes including what the command name and parameters were when the process was created. The pg command limits output to a single page at a time, so information does not scroll too quickly off the screen.

    Check for system or user processes that are using excessive amounts of a system resource, such as CPU time. System processes such as sendmail, routed, and lpd seem to be the system processes most prone to becoming runaways.

  2. To check for user processes that use more CPU than expected, type:
    ps -u
  3. Note the process ID (PID) of each problem process.

Terminate the Process

Use the following procedure to terminate a problem process:

  1. Terminate the process that is causing the problem by typing:
    kill -9 PID

    Where PID is the ID of the problem process.

  2. Remove the files the process has been making by typing:
    rm file1 file2 file3
    Where file1 file2 file3 represents names of process-related files.

Reclaim File Space without Terminating the Process

When an active file is removed from the file system, the blocks allocated to the file remain allocated until the last open reference is removed, either as a result of the process closing the file or because of the termination of the processes that have the file open. If a runaway process is writing to a file and the file is removed, the blocks allocated to the file are not freed until the process terminates.

To reclaim the blocks allocated to the active file without terminating the process, redirect the output of another command to the file. The data redirection truncates the file and reclaims the blocks of memory. For example:

$ ls -l
total 1248
-rwxrwxr-x      1 web   staff   1274770 Jul 20 11:19 datafile
$ date > datafile
$ ls -l
total 4
-rwxrwxr-x      1 web   staff        29 Jul 20 11:20 datafile

The output of the date command replaced the previous contents of the datafile file. The blocks reported for the truncated file reflect the size difference from 1248> to 4. If the runaway process continues to append information to this newly truncated file, the next ls command produces the following results:

$ ls -l
total 8
-rxrwxr-x       1 web   staff   1278866 Jul 20 11:21 datefile

The size of the datafile file reflects the append done by the runaway process, but the number of blocks allocated is small. The datafile file now has a hole in it. File holes are regions of the file that do not have disk blocks allocated to them.

Fix a / (root) Overflow

Check the following when the root file system (/) has become full:

Fix a /var Overflow

Check the following when the /var file system has become full:

Fix a User-Defined File System Overflow

Use this procedure to fix an overflowing user-defined file system.

  1. Remove old backup files and core files. The following example removes all *.bak, .*.bak, a.out, core, *, or ed.hup files.
    find / \( -name "*.bak" -o -name core -o -name a.out -o \
            -name "...*" -o -name ".*.bak" -o -name ed.hup \) \
            -atime +1 -mtime +1 -type f -print | xargs -e rm -f
  2. To prevent files from regularly overflowing the disk, run the skulker command as part of the cron process and remove files that are unnecessary or temporary.

    The skulker command purges files in /tmp directory, files older than a specified age, a.out files, core files, and ed.hup files. It is run daily as part of an accounting procedure run by the cron command during off-peak periods (assuming you have turned on accounting).

    The cron daemon runs shell commands at specified dates and times. Regularly scheduled commands such as skulker can be specified according to instructions contained in the crontab files. Submit crontab files with the crontab command. To edit a crontab file, you must have root user authority.

    For more information about how to create a cron process or edit the crontab file, refer to Setting Up an Accounting System.

Fix Other File Systems and General Search Techniques

Use the find command with the -size flag to locate large files or, if the file system recently overflowed, use the -newer flag to find recently modified files. To produce a file for the -newer flag to find against, use the following touch command:

touch mmddhhmm filename 

Where mm is the month, dd is the date, hh is the hour in 24-hour format, mm is the minute, and filename is the name of the file you are creating with the touch command.

After you have created the touched file, you can use the following command to find newer large files:

find /filesystem_name -xdev -newer touch_filename -ls

You can also use the find command to locate files that have been changed in the last 24 hours, as shown in the following example:

find /filesystem_name -xdev -mtime 0 -ls

Fix a Damaged File System

File systems can get corrupted when the i-node or superblock information for the directory structure of the file system gets corrupted. This can be caused by a hardware-related ailment or by a program that gets corrupted that accesses the i-node or superblock information directly. (Programs written in assembler and C can bypass the operating system and write directly to the hardware.) One symptom of a corrupt file system is that the system cannot locate, read, or write data located in the particular file system.

To fix a damaged file system, you must diagnose the problem and then repair it. The fsck command performs low-level diagnosis and repairs.

Procedure

  1. With root authority, unmount the damaged file system using one of the following SMIT fast paths: smit unmountfs (for a file system on a fixed disk drive) or smit unmntdsk (for a file system on a removeable disk).
  2. Assess file system damage by running the fsck command. In the following example, the fsck command checks the unmounted file system located on the /dev/myfilelv device:
    fsck /dev/myfilelv

    The fsck command checks and interactively repairs inconsistent file systems. Normally, the file system is consistent, and the fsck command merely reports on the number of files, used blocks, and free blocks in the file system. If the file system is inconsistent, the fsck command displays information about the inconsistencies found and prompts you for permission to repair them. The fsck command is conservative in its repair efforts and tries to avoid actions that might result in the loss of valid data. In certain cases, however, the fsck command recommends the destruction of a damaged file. Refer to the fsck command description in AIX 5L Version 5.2 Commands Reference for a list of inconsistences that this command checks for.

  3. If the file system cannot be repaired, restore it from backup.
    Attention: Restoring a file system from a backup destroys and replaces any file system previously stored on the disk.

    To restore the file system from backup, use the SMIT fastpath smit restfilesys or the series of commands shown in the following example:

    mkfs /dev/myfilelv
    mount /dev/myfilelv /myfilesys
    cd /myfilesys
    restore -r

    In this example, the mkfs command makes a new file system on the device named /dev/myfilelv and initializes the volume label, file system label, and startup block. The mount command establishes /dev/myfilelv as the mountpoint for myfilesys and the restore command extracts the file system from the backup.

    If your backup was made using incremental file system backups, you must restore the backups in increasing backup-level order (for example, 0, 1, 2). For more information about restoring a file system from backup, refer to "Restoring from Backup Image Individual User Files".

    When using smit restfilesys to restore an entire file system, enter the target directory, restore device (other than /dev/rfd0), and number of blocks to read in a single input operation.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]