Question
========
This document discusses using the persistent fsck logging capabilities of the AIX JFS2 filesystem.

Answer
======
The fsck utility is used to repair damage done to the filesystem. For JFS2 filesystems fsck keeps a log in the fsck working area of what was run and the output of fsck. It keeps this for the last run of fsck and one run prior to that. These can be printed out using /sbin/helpers/jfs2/fscklog, which can be helpful to service personnel.

The fscklog can contain more verbose output than what was written to the screen when fsck was initially run, aiding in debug of filesystem problems.

How can I check which log is current, or if there is one for my filesystem?

In the header file /usr/include/j2/j2_superblock.h we see there is a value for the fscklog, which is stored in the superblock of the filesystem:

int32 s_fscklog; /* 4: which fsck service log is most recent
* 0 => no service log data yet
* 1 => the first one
* 2 => the 2nd one

The superblock on JFS2 filesystem starts at 32kb (0x8000) into the logical volume, and the variable s_fscklog is at 0x80A0

# lquerypv -h /dev/fslv05 80A0 10
000080A0 00000001 00000000 00000000 00000000 |…………….|

So on this filesystem the first log is the most recent, as the s_fscklog value = 1

How can I view one of the fsck logs?

Using the fscklog utility you can print the contents of either current or previous log. You can supply either the filesystem mount point or the device (logical volume) the filesystem is on.

# /sbin/helpers/jfs2/fscklog /dev/fslv00

or use the filesystem mount point:

# /sbin/helpers/jfs2/fscklog /mymount

If you wish to print out the prior log, use -p flag

# /sbin/helpers/jfs2/fscklog -p /dev/fslv00

Advertisements