Question & Answer
Question
When should I run the
logform
command?Answer
What is
The /usr/sbin/
When the fsck utility is run to repair a damaged filesystem, one of the first actions taken is to call /usr/sbin/
Many times you can watch fsck call
If you run
When should
When
or
This output can signify that the log device may be bad, or it may actually be missing from the volume group. If it is missing, fsck will not be able to call
In some cases, fsck may coredump or hang when it calls
In the above
If the
logform
?The /usr/sbin/
logform
command formats a JFS or JFS2 filesystem log device (or inline log for JFS2 filesystems uses inline logs), so the filesystem can log transactions that modify filesystem metadata. This log device is the journal in "Journaled File System".When the fsck utility is run to repair a damaged filesystem, one of the first actions taken is to call /usr/sbin/
logredo
. Logredo
is a "helper" application that goes through the log device and finds updates to the filesystem that have not been committed, then commits them. These updates may be uncommitted because of a system problem such as a crash or storage outage.Many times you can watch fsck call
logredo
as seen in the following output:# fsck /encry
The current volume is: /dev/fslv05
Primary superblock is valid.
J2_LOGREDO:log redo processing for /dev/fslv05
Primary superblock is valid.
*** Phase 1 - Initial inode scan
*** Phase 2 - Process remaining directories
*** Phase 3 - Process remaining files
*** Phase 4 - Check and repair inode allocation map
*** Phase 5 - Check and repair block allocation map
File system is clean.
If you run
logform
before giving logredo
a chance to commit changes to the filesystem, you may damage the filesystem and cause data loss.When should
logform
be used? When
logredo
is having trouble replaying the transaction log.# fsck /dev/hd3
The current volume is /dev/hd3
j2_logredo
: logredo
processing for /dev/hd3
j2_logredo
.cpp error in j2logredo
line 647 open read device
failure replaying log: -1
exec module "/sbin/helpers/jfs2/logredo
:" failed
logredo failed (rc=255) fsck continuing
or
# fsck -y /data42
The current volume is: /dev/data42lv
Primary superblock is valid.
J2_LOGREDO:log redo processing for /dev/data42lv
j2_logredo
.cpp: ERROR in openLog line 2439, makeOpen
fsError:bad error in volume 1
Open failed
j2_logredo
.cpp: ERROR in openFilesystems line 1873, openLog
j2_logredo
.cpp: ERROR in j2_logredo
line 661, openFilesystems
Failure replaying log: -2
This output can signify that the log device may be bad, or it may actually be missing from the volume group. If it is missing, fsck will not be able to call
logredo
successfully, so we'll have to run logform
and risk loss of any changes that weren't committed to the filesystem.In some cases, fsck may coredump or hang when it calls
logredo
, due to the nature of the damage. If fsck is hung or stuck during logredo
, you may be able to find it using the proctree
command:# proctree 38797510
38797510 fsck /dev/rdatalv
17170476 /sbin/helpers/jfs2/fsck64 /dev/datalv
5505138 /sbin/helpers/jfs2/logredo
64 /dev/data3lv
In the above
proctree
output, the initial fsck command has called the JFS2 64-bit helper to do the actual repair work, and fsck64 has called logredo
64 to go through the log and commit any writes that are necessary.If the
logredo
64 is hung, then it is possible the log is damaged and must be reformatted. This reformatting will lose any uncommitted writes to the filesystem, but should allow fsck to complete when it is run again.If you must run logform to repair or reconstruct the journal, it is important to note that multiple filesystems can share the same journal (or log device), so all filesystems using it must be unmounted first. You can easily verify if the log device is in use, with the lslv command:
This log device is open and being used, because you can see the state is "open".
This log device is "closed" and is safe to reformat.
Summary
If you decide to run
fsck fails with errors regarding
# lsvg -l vgname
testvg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
loglv03 jfslog 1 1 1 open/syncd N/A
This log device is open and being used, because you can see the state is "open".
loglv01 jfs2log 1 2 2 closed/syncd N/A
This log device is "closed" and is safe to reformat.
Summary
If you decide to run
logform
to reformat the log, run at least 1 fsck first.# fsck /fsname
fsck fails with errors regarding
logredo
or hangs during logredo
# logform
/dev/loglv
(or /dev/lvname in the case of inline log)# fsck /fsname
(try fsck again)
[{"Product":{"code":"SWG10","label":"AIX"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"File management","Platform":[{"code":"PF002","label":"AIX"}],"Version":"Version Independent","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]
Was this topic helpful?
Document Information
More support for:
AIX
Software version:
Version Independent
Operating system(s):
AIX
Document number:
670151
Modified date:
14 November 2019
UID
isg3T1011054
Manage My Notification Subscriptions