http://www.rs6000.ibm.com/resource/
fsck [options] /dev/LVnameOR
fsck [options] /fsnameThe file system MUST be unmounted for any operation to occur. The fsck command needs the file system to be in a consistent state while performing its checks. Attempts by users to write to the file system might cause fsck to report corruption that does not exist. For this reason, any errors reported by fsck while the file system is mounted may not be relevant.
Various options for fsck exist:
-f | indicates to perform a fast check; files systems with "check = true" entries in /etc/filesystems are checked |
-p | fixes minor problems without interaction from user |
-y | gives permission to correct every problem found |
-n | indicates not to correct any problems |
See the man page for fsck for more information.
While the -y flag is certainly time-saving, be careful with this option. If fsck cannot read a block due to a missing disk, for example, it will ask to clear the block. If the disk is missing due to an adapter failure, for instance, you may be removing recoverable data by responding yes or by giving the fsck command explicit permission to fix everything it finds.
Examples of fsck use:
fsck /dev/lv00 fsck -y /data fsck -p /dev/lv00The logform command formats a logical volume for use as a log device, which stores transactional information about file system metadata changes and can be used to roll back incomplete operations if the machine crashes. The logform command is destructive; it wipes out all data in the logical volume. Accidentally running this on a file system completely destroys all file system data. The logform command should only be run on CLOSED logical volumes. If a log device is open due to its use by a mounted file system, the file system should be unmounted prior to running logform against the log device. You can check to ensure that the log device is closed by running the following:
lsvg -l VGnameHere are some examples of messages you might receive that would indicate a corrupt log device:
failure replaying log media is not formatted or format is not correctExamples of logform use:
logform /dev/loglv00 logform: destroy /dev/loglv00 (y)?y
fsck: Not an AIX3 file system fsck: Not an AIXV3 file system fsck: Not an AIX4 file system fsck: Not an AIXV4 file system fsck: Not a recognized file system type mount: invalid argumentThe backup superblock can be copied over the primary superblock via one of these commands:
All versions:
dd count=1 bs=4k skip=31 seek=1 if=/dev/lv00 of=/dev/lv00For AIX 4.x only:
fsck -p /dev/lv00Once the copying over is completed, check the integrity of the file system by issuing:
fsck /dev/lv00In many cases, copying the backup superblock to the primary superblock will recover the file system. If this does not work, you will have to recreate the file system, and restore the data from a backup.
ODMDIR=/etc/objrepos
fsck /dev/hd4 fsck /dev/hd2 fsck /dev/hd3 fsck /dev/hd9varOther fsck options as outlined previously can also be used, where appropriate.
logform /dev/hd8Answer "y" when asked if you want to destroy the log.
sync; sync; sync; shutdown -Fr
You can also run fsck on any user-created file systems in rootvg, if needed. This can typically be done in normal mode.
AIX | APAR | DESCRIPTION |
4.1.4 | IX54927 | logredo fails trying to open log |
4.1.4 | IX55250 | fsck does not fix inodes with corrupted ACLs |
4.1.4 | IX56526 | fsck may fail to replay log |
4.1.4 | IX60754 | Do not allow logform to format past 256MB of loglv |
4.2T | IX68182 | fsck coredumps while correcting errors |
4.2 | IX76061 | defragfs and fsck incorrectly report bad bit map |
You can check if a particular APAR is installed at version 4 with instfix -ik IX99999, for example.