File: [Development] / xfs-cmds / xfsprogs / man / man8 / xfs_repair.8 (download)
Revision 1.7, Fri Oct 6 04:02:52 2006 UTC (11 years ago) by chatz.longdrop.melbourne.sgi.com
Branch: MAIN
Changes since 1.6: +50 -9
lines
Add IRIX build targets and update man pages for parallelized repair.
Merge of master-melb:xfs-cmds:27138a by kenmcd.
pv:956061 Add new parallel options.
|
.TH xfs_repair 8
.SH NAME
xfs_repair \- repair an XFS filesystem
.SH SYNOPSIS
.nf
\f3xfs_repair\f1 [ \f3\-dLMnPvV\f1 ] [ \f3\-o\f1 subopt[=value] ]
[\f3-t\f1 interval] [\f3-l\f1 logdev] [\f3-r\f1 rtdev] xfs_special
.sp .8v
\f3xfs_repair\f1 \f3\-f\f1 [ \f3\-dLMnPvV\f1 ] [ \f3\-o\f1 subopt[=value] ]
[\f3-t\f1 interval] [\f3-l\f1 logdev] [\f3-r\f1 rtdev] ... file
.fi
.SH DESCRIPTION
.I xfs_repair
is a parallelized version of
.IR xfs_repair (1m)
that repairs corrupt or damaged XFS filesystems
(see
.IR xfs (5)).
The filesystem is specified using the
.I xfs_special
argument which should be the device name of the
disk partition or volume containing
the filesystem.
If given the name of a block device,
.I xfs_repair
will attempt to find the raw device associated
with the specified block device and will use the raw device
instead.
.PP
Regardless, the filesystem to be repaired
must be unmounted,
otherwise, the resulting filesystem may be inconsistent or corrupt.
.PP
The options to \f2xfs_repair\f1 are:
.TP
.B \-f
Specifies that the special device is actually a file (see the
\f2mkfs.xfs\f1 \f3\-d\f1 \f2file\f1 option).
This might happen if an image copy
of a filesystem has been copied or written into an ordinary file.
This option implies that any external log or realtime section
is also in an ordinary file.
.TP
.B \-L
Force Log Zeroing.
Forces
.I xfs_repair
to zero the log even if it is dirty (contains metadata changes).
When using this option the filesystem will likely appear to be corrupt,
and can cause the loss of user files and/or data.
.TP
\f3-l\f1 \f2logdev\f1
Specifies the device special file where the filesystem's external
log resides.
Only for those filesystems which use an external log.
See the
\f2mkfs.xfs\f1 \f3\-l\f1 option, and refer to
.IR xfs (5)
for a detailed description of the XFS log.
.TP
\f3-r\f1 \f2rtdev\f1
Specifies the device special file where the filesystem's realtime
section resides.
Only for those filesystems which use a realtime section.
See the
\f2mkfs.xfs\f1 \f3\-r\f1 option, and refer to
.IR xfs (5)
for a detailed description of the XFS realtime section.
.TP
.B \-n
No modify mode.
Specifies that
.I xfs_repair
should not modify the filesystem but should only scan the
filesystem and indicate what repairs would have been made.
.TP
\f3-o\f1 \f2subopt[=value]\f1
Override what the program might conclude about the filesystem
if left to its own devices.
.IP
The
.B assume_xfs
suboption
specifies that the filesystem is an XFS filesystem.
Normally, if
.I xfs_repair
cannot find an XFS superblock, it checks to see if the
filesystem is an EFS filesystem before it tries to
regenerate the XFS superblock.
If the
.B assume_xfs
option is in effect,
.I xfs_repair
will assume that the filesystem is an XFS filesystem and
will ignore an EFS superblock if one is found.
.IP
The
.BI ihash= ihashsize
suboption modifies the default xfs_repair inode cache hash size.
The total number of inode cache entries are limited to 8 times this
amount.
.IP
The
.BI bhash= bhashsize
suboption modifies the default xfs_repair buffer cache hash size.
The total number of buffer cache entries are limited to 8 times this
amount.
.IP
The
.BI pfino= inode_blocks
suboption modifies the default size of read ahead xfs_repair inode
blocks.
.IP
The
.BI pfdir= dir_blocks
suboption modifies the default size of read ahead xfs_repair dir
blocks.
.IP
The
.BI thread= thread_count
suboption modifies the number of xfs_repair parallel threads.
.TP
\f3-t\f1 \f2interval\f1
Modify reporting interval. During long runs xfs_repair outputs
its progress every 15 minutes. Reporting is only activated when
xfs_repair is multi-threaded.
.TP
.B \-M
Disable multi-threaded mode. Normally, xfs_repair runs with twice
the number of threads as processors.
.TP
.B \-P
Disable read ahead of inode and directory blocks. If applicable,
a read ahead of up to 16 additional blocks is done.
.TP
.B \-v
Verbose output.
.TP
.B \-d
Repair dangerously. Allow xfs_repair to repair an XFS filesystem
mounted read only. This is typically done on a root fileystem from
single user mode, immediately followed by a reboot.
.SS Checks Performed
Inconsistencies corrected include the following:
.TP
1.
Inode and inode blockmap (addressing) checks:
bad magic number in inode,
bad magic numbers in inode blockmap blocks,
extents out of order,
incorrect number of records in inode blockmap blocks,
blocks claimed that are not in a legal data area of the filesystem,
blocks that are claimed by more than one inode.
.TP
2.
Inode allocation map checks:
bad magic number in inode map blocks,
inode state as indicated by map (free or in-use) inconsistent
with state indicated by the inode,
inodes referenced by the filesystem that do not appear in
the inode allocation map,
inode allocation map referencing blocks that do not appear
to contain inodes.
.TP
3.
Size checks:
number of blocks claimed by inode inconsistent with inode size,
directory size not block aligned,
inode size not consistent with inode format.
.TP
4.
Directory checks:
bad magic numbers in directory blocks,
incorrect number of entries in a directory block,
bad freespace information in a directory leaf block,
entry pointing to an unallocated (free) or out
of range inode,
overlapping entries,
missing or incorrect dot and dotdot entries,
entries out of hashvalue order,
incorrect internal directory pointers,
directory type not consistent with inode format and size.
.TP
5.
Pathname checks:
files or directories not referenced by a pathname starting from
the filesystem root,
illegal pathname components.
.TP
6.
Link count checks:
link counts that do not agree with the number of
directory references to the inode.
.TP
7.
Freemap checks:
blocks claimed free by the freemap but also claimed by an inode,
blocks unclaimed by any inode but not appearing in the freemap.
.TP
8.
Super Block checks:
total free block and/or free i-node count incorrect,
filesystem geometry inconsistent,
secondary and primary superblocks contradictory.
.PP
Orphaned files and directories (allocated, in-use but unreferenced) are
reconnected by placing them in the
.I lost+found
directory.
The name assigned is the inode number.
.SS Disk Errors
.I xfs_repair
aborts on most disk I/O errors.
Therefore, if you are trying
to repair a filesystem that was damaged due to a disk drive failure,
steps should be taken to ensure that
all blocks in the filesystem are readable and writeable
before attempting to use
.I xfs_repair
to repair the filesystem.
A possible method is using
.IR dd (8)
to copy the data onto a good disk.
.SS lost+found
The directory
.I lost+found
does not have to already exist in the filesystem being repaired.
If the directory does not exist, it is automatically created.
If the \f2lost+found\f1 directory already exists,
the \f2lost+found\f1
directory is deleted and recreated every time \f2xfs_repair\f1
runs.
This ensures that there are no name conflicts in \f2lost+found\f1.
However, if you rename a file in \f2lost+found\f1 and leave it there,
if \f2xfs_repair\f1 is run again, that file is renamed back to
its inode number.
.SS Corrupted Superblocks
XFS has both primary and secondary superblocks.
\f2xfs_repair\f1 uses information in the primary superblock
to automatically find and validate the primary superblock
against the secondary superblocks before proceeding.
Should the primary be too corrupted to be useful in locating
the secondary superblocks, the program scans the filesystem
until it finds and validates some secondary superblocks.
At that point, it generates a primary superblock.
.SS Quotas
If quotas are in use, it is possible that \f2xfs_repair\f1 will clear
some or all of the filesystem quota information.
If so, the program issues a warning just before it terminates.
If all quota information is lost, quotas are disabled and the
program issues a warning to that effect.
.PP
Note that \f2xfs_repair\f1 does not check the validity of quota limits.
It is recommended that you check the quota limit information manually
after \f2xfs_repair\f1.
Also, space usage information is automatically regenerated the
next time the filesystem is mounted with quotas turned on, so the
next quota mount of the filesystem may take some time.
.SH DIAGNOSTICS
.I xfs_repair
issues informative messages as it proceeds
indicating what it has found that is abnormal or any corrective
action that it has taken.
Most of the messages are completely understandable only to those
who are knowledgeable about the structure of the filesystem.
Some of the more common messages are explained here.
Note that the language of the messages is slightly different
if \f2xfs_repair\f1 is run in no-modify mode because the program is not
changing anything on disk.
No-modify mode indicates what it would do to repair the filesystem
if run without the no-modify flag.
.PP
disconnected inode \f3xxxx\f1, moving to \f2lost+found\f1
.IP
An inode numbered
.B xxxx
was not connected to the filesystem
directory tree and was reconnected to the \f2lost+found\f1 directory.
The inode is assigned the name of its inode number (i-number).
If a \f2lost+found\f1 directory does not exist, it is automatically
created.
.PP
disconnected dir inode \f3xxxx\f1, moving to \f2lost+found\f1
.IP
As above only the inode is a directory inode.
If a directory inode is attached to \f2lost+found\f1, all of its
children (if any) stay attached to the directory and therefore
get automatically reconnected when the directory is reconnected.
.PP
imap claims in-use inode \f3xxxx\f1 is free, correcting imap
.IP
The inode allocation map thinks that inode \f3xxxx\f1 is
free whereas examination of the inode indicates that the
inode may be in use (although it may be disconnected).
The program updates the inode allocation map.
.PP
imap claims free inode \f3xxxx\f1 is in use, correcting imap
.IP
The inode allocation map thinks that inode \f3xxxx\f1 is
in use whereas examination of the inode indicates that the
inode is not in use and therefore is free.
The program updates the inode allocation map.
.PP
resetting inode \f3xxxx\f1 nlinks from \f3x\f1 to \f3y\f1
.IP
The program detected a mismatch between the
number of valid directory entries referencing inode \f3xxxx\f1
and the number of references recorded in the inode and corrected the
the number in the inode.
.PP
\f3fork-type\f1 fork in ino \f3xxxx\f1 claims used block \f3yyyy\f1
.IP
Inode \f3xxxx\f1 claims a block \f3yyyy\f1 that is used (claimed)
by either another inode or the filesystem itself for metadata storage.
The \f3fork-type\f1 is either \f3data\f1 or \f3attr\f1
indicating whether the problem lies in the portion of the
inode that tracks regular data or the portion of the inode
that stores XFS attributes.
If the inode is a real-time (rt) inode, the message says so.
Any inode that claims blocks used by the filesystem is deleted.
If two or more inodes claim the same block, they are both deleted.
.PP
\f3fork-type\f1 fork in ino \f3xxxx\f1 claims dup extent ...
.IP
Inode \f3xxxx\f1 claims a block in an extent known to be
claimed more than once.
The offset in the inode, start and length of the extent is given.
The message is slightly different
if the inode is a real-time (rt) inode and the extent is therefore
a real-time (rt) extent.
.PP
inode \f3xxxx\f1 - bad extent ...
.IP
An extent record in the blockmap of inode \f3xxxx\f1 claims
blocks that are out of the legal range of the filesystem.
The message supplies the start, end, and file offset of
the extent.
The message is slightly different
if the extent is a real-time (rt) extent.
.PP
bad \f3fork-type\f1 fork in inode \f3xxxx\f1
.IP
There was something structurally wrong or inconsistent with the
data structures that map offsets to filesystem blocks.
.PP
cleared inode \f3xxxx\f1
.IP
There was something wrong with the inode that
was uncorrectable so the program freed the inode.
This usually happens because the inode claims
blocks that are used by something else or the inode itself
is badly corrupted.
Typically, this message
is preceded by one or more messages indicating why the
inode needed to be cleared.
.PP
bad attribute fork in inode \f3xxxx\f1, clearing attr fork
.IP
There was something wrong with the portion of the inode that
stores XFS attributes (the attribute fork) so the program reset
the attribute fork.
As a result of this, all attributes on that inode are lost.
.PP
correcting nextents for inode \f3xxxx\f1, was \f3x\f1 - counted \f3y\f1
.IP
The program found that the number of extents used to store
the data in the inode is wrong and corrected the number.
The message refers to nextents if the count is wrong
on the number of extents used to store attribute information.
.PP
entry \f3"name"\f1 in dir \f3xxxx\f1 not consistent
with ..
value (\f3yyyy\f1) in dir ino \f3xxxx\f1,
junking entry \f3"name"\f1 in directory inode \f3xxxx\f1
.IP
The entry \f3"name"\f1 in directory inode \f3xxxx\f1 references a
directory inode \f3yyyy\f1.
However, the ..\& entry in directory \f3yyyy\f1 does not point
back to directory \f3xxxx\f1,
so the program deletes the entry \f3"name"\f1 in directory inode
\f3xxxx\f1.
If the directory inode \f3yyyy\f1 winds up becoming a disconnected
inode as a result of this, it is moved to \f2lost+found\f1 later.
.PP
entry \f3"name"\f1 in dir \f3xxxx\f1 references already
connected dir ino \f3yyyy\f1,
junking entry \f3"name"\f1 in directory inode \f3xxxx\f1
.IP
The entry \f3"name"\f1 in directory inode \f3xxxx\f1 points to a
directory inode \f3yyyy\f1 that is known to be a child of another
directory.
Therefore, the entry is invalid and is deleted.
This message refers to an entry in a small directory.
If this were a large directory, the last phrase would read
"will clear entry".
.PP
entry references free inode \f3xxxx\f1 in directory \f3yyyy\f1,
will clear entry
.IP
An entry in directory inode \f3yyyy\f1 references an inode \f3xxxx\f1
that is known to be free.
The entry is therefore invalid and is deleted.
This message refers to a large directory.
If the directory were small, the message would read "junking entry ...".
.SH EXIT STATUS
.I xfs_repair -n
(no modify node)
will return a status of 1 if filesystem corruption was detected and
0 if no filesystem corruption was detected.
.I xfs_repair
run without the \-n option will always return a status code of 0.
.SH BUGS
The filesystem to be checked and repaired must have been
unmounted cleanly using normal system administration procedures
(the
.IR umount (8)
command or system shutdown), not as a result of a crash or system reset.
If the filesystem has not been unmounted cleanly, mount it and unmount
it cleanly before running
.IR xfs_repair .
.PP
.I xfs_repair
does not do a thorough job on XFS extended attributes.
The structure of the attribute fork will be consistent,
but only the contents of attribute forks that will fit into
an inode are checked.
This limitation will be fixed in the future.
.PP
The no-modify mode (\f3\-n\f1 option) is not completely
accurate.
It does not catch inconsistencies in the freespace and inode
maps, particularly lost blocks or subtly corrupted maps (trees).
.PP
The no-modify mode can generate repeated warnings about
the same problems because it cannot fix the problems as they
are encountered.
.SH SEE ALSO
dd(1),
mkfs.xfs(8),
umount(8),
xfs_check(8),
xfs(5).