1xfs_repair(8)               System Manager's Manual              xfs_repair(8)
2
3
4

NAME

6       xfs_repair - repair an XFS filesystem
7

SYNOPSIS

9       xfs_repair  [  -dfLnPv  ]  [  -o  subopt[=value] ] [ -t interval ] [ -l
10       logdev ] [ -r rtdev ] device
11       xfs_repair -V
12

DESCRIPTION

14       xfs_repair repairs corrupt or damaged  XFS  filesystems  (see  xfs(5)).
15       The  filesystem  is specified using the device argument which should be
16       the device name of the disk partition or volume containing the filesys‐
17       tem.  If  given  the name of a block device, xfs_repair will attempt to
18       find the raw device associated with the specified block device and will
19       use the raw device instead.
20
21       Regardless, the filesystem to be repaired must be unmounted, otherwise,
22       the resulting filesystem may be inconsistent or corrupt.
23

OPTIONS

25       -f     Specifies that the filesystem image to be processed is stored in
26              a regular file at device (see the mkfs.xfs -d file option). This
27              might happen if an image copy of a filesystem has been copied or
28              written  into  an  ordinary  file.  This option implies that any
29              external log or realtime section is also in an ordinary file.
30
31       -L     Force Log Zeroing.  Forces xfs_repair to zero the log even if it
32              is  dirty  (contains  metadata changes).  When using this option
33              the filesystem will likely appear to be corrupt, and  can  cause
34              the loss of user files and/or data.
35
36       -l logdev
37              Specifies  the device special file where the filesystem's exter‐
38              nal log resides. Only for those filesystems which use an  exter‐
39              nal  log.  See the mkfs.xfs -l option, and refer to xfs(5) for a
40              detailed description of the XFS log.
41
42       -r rtdev
43              Specifies the device special file where the  filesystem's  real‐
44              time  section  resides.  Only  for those filesystems which use a
45              realtime section.  See the mkfs.xfs  -r  option,  and  refer  to
46              xfs(5) for a detailed description of the XFS realtime section.
47
48       -n     No  modify mode. Specifies that xfs_repair should not modify the
49              filesystem but should only scan the filesystem and indicate what
50              repairs would have been made.
51
52       -o subopt[=value]
53              Override what the program might conclude about the filesystem if
54              left to its own devices.
55
56              The suboptions supported are:
57
58                 ihash=ihashsize
59                        overrides the default inode cache hash size. The total
60                        number  of  inode cache entries are limited to 8 times
61                        this amount. The default  ihashsize  is  1024  (for  a
62                        total of 8192 entries).
63
64                 bhash=bhashsize
65                        overrides  the  default  buffer  cache  hash size. The
66                        total number of buffer cache entries are limited to  8
67                        times  this  amount. The default size is set to use up
68                        the remainder of 75% of  the  system's  physical  RAM.
69                        size
70
71                 ag_stride=ags_per_concat_unit
72                        This creates additional processing threads to parallel
73                        process AGs that span multiple concat units. This  can
74                        significantly  reduce  repair  times  on  concat based
75                        filesystems.
76
77       -t  interval
78              Modify reporting interval. During long runs  xfs_repair  outputs
79              its  progress every 15 minutes. Reporting is only activated when
80              ag_stride is enabled.
81
82       -P     Disable prefetching of inode and directory blocks.
83
84       -v     Verbose output.
85
86       -d     Repair dangerously. Allow xfs_repair to repair an XFS filesystem
87              mounted  read  only.  This is typically done on a root fileystem
88              from single user mode, immediately followed by a reboot.
89
90       -V     Prints out the current version number and exits.
91
92   Checks Performed
93       Inconsistencies corrected include the following:
94
95       1.     Inode and inode blockmap (addressing) checks: bad  magic  number
96              in  inode,  bad  magic numbers in inode blockmap blocks, extents
97              out of order, incorrect number  of  records  in  inode  blockmap
98              blocks,  blocks claimed that are not in a legal data area of the
99              filesystem, blocks that are claimed by more than one inode.
100
101       2.     Inode allocation map checks:  bad  magic  number  in  inode  map
102              blocks,  inode state as indicated by map (free or in-use) incon‐
103              sistent with state indicated by the inode, inodes referenced  by
104              the  filesystem  that do not appear in the inode allocation map,
105              inode allocation map referencing blocks that do  not  appear  to
106              contain inodes.
107
108       3.     Size checks: number of blocks claimed by inode inconsistent with
109              inode size, directory size not block  aligned,  inode  size  not
110              consistent with inode format.
111
112       4.     Directory  checks: bad magic numbers in directory blocks, incor‐
113              rect number of entries  in  a  directory  block,  bad  freespace
114              information  in  a  directory  leaf  block, entry pointing to an
115              unallocated (free) or out of range inode,  overlapping  entries,
116              missing  or  incorrect  dot  and  dotdot entries, entries out of
117              hashvalue order, incorrect internal directory  pointers,  direc‐
118              tory type not consistent with inode format and size.
119
120       5.     Pathname  checks: files or directories not referenced by a path‐
121              name starting from the filesystem root, illegal pathname  compo‐
122              nents.
123
124       6.     Link count checks: link counts that do not agree with the number
125              of directory references to the inode.
126
127       7.     Freemap checks: blocks claimed free  by  the  freemap  but  also
128              claimed  by  an  inode,  blocks  unclaimed  by any inode but not
129              appearing in the freemap.
130
131       8.     Super Block checks: total free block and/or  free  i-node  count
132              incorrect,  filesystem geometry inconsistent, secondary and pri‐
133              mary superblocks contradictory.
134
135       Orphaned files and directories (allocated, in-use but unreferenced) are
136       reconnected  by  placing  them  in  the lost+found directory.  The name
137       assigned is the inode number.
138
139   Disk Errors
140       xfs_repair aborts on most disk I/O errors. Therefore, if you are trying
141       to  repair  a  filesystem that was damaged due to a disk drive failure,
142       steps should be taken to ensure that all blocks in the  filesystem  are
143       readable  and  writeable  before attempting to use xfs_repair to repair
144       the filesystem. A possible method is using dd(8) to copy the data  onto
145       a good disk.
146
147   lost+found
148       The directory lost+found does not have to already exist in the filesys‐
149       tem being repaired.  If the directory does not exist, it  is  automati‐
150       cally  created  if  required.  If it already exists, it will be checked
151       for consistency and if valid  will  be  used  for  additional  orphaned
152       files. Invalid lost+found directories are removed and recreated. Exist‐
153       ing files in a valid lost+found are not removed or renamed.
154
155   Corrupted Superblocks
156       XFS has both primary and secondary superblocks.  xfs_repair uses infor‐
157       mation in the primary superblock to automatically find and validate the
158       primary superblock against the secondary superblocks before proceeding.
159       Should  the  primary be too corrupted to be useful in locating the sec‐
160       ondary superblocks, the program scans the filesystem until it finds and
161       validates  some  secondary  superblocks.  At that point, it generates a
162       primary superblock.
163
164   Quotas
165       If quotas are in use, it is possible that xfs_repair will clear some or
166       all  of  the filesystem quota information.  If so, the program issues a
167       warning just before it terminates.  If all quota information  is  lost,
168       quotas are disabled and the program issues a warning to that effect.
169
170       Note that xfs_repair does not check the validity of quota limits. It is
171       recommended that you check the quota limit information  manually  after
172       xfs_repair.  Also, space usage information is automatically regenerated
173       the next time the filesystem is mounted with quotas turned on,  so  the
174       next quota mount of the filesystem may take some time.
175

DIAGNOSTICS

177       xfs_repair  issues  informative messages as it proceeds indicating what
178       it has found that is abnormal or any  corrective  action  that  it  has
179       taken.   Most  of  the  messages  are completely understandable only to
180       those who are knowledgeable about  the  structure  of  the  filesystem.
181       Some  of  the  more  common messages are explained here.  Note that the
182       language of the messages is slightly different if xfs_repair is run  in
183       no-modify  mode  because  the program is not changing anything on disk.
184       No-modify mode indicates what it would do to repair the  filesystem  if
185       run without the no-modify flag.
186
187       disconnected inode ino, moving to lost+found
188
189              An inode numbered ino was not connected to the filesystem direc‐
190              tory tree and was reconnected to the lost+found  directory.  The
191              inode  is  assigned  the  name  of its inode number (ino).  If a
192              lost+found directory does not exist, it  is  automatically  cre‐
193              ated.
194
195       disconnected dir inode ino, moving to lost+found
196
197              As  above  only  the inode is a directory inode.  If a directory
198              inode is attached to lost+found, all of its  children  (if  any)
199              stay  attached  to the directory and therefore get automatically
200              reconnected when the directory is reconnected.
201
202       imap claims in-use inode ino is free, correcting imap
203
204              The inode allocation map thinks that inode ino is  free  whereas
205              examination  of the inode indicates that the inode may be in use
206              (although it may be  disconnected).   The  program  updates  the
207              inode allocation map.
208
209       imap claims free inode ino is in use, correcting imap
210
211              The inode allocation map thinks that inode ino is in use whereas
212              examination of the inode indicates that the inode is not in  use
213              and therefore is free.  The program updates the inode allocation
214              map.
215
216       resetting inode ino nlinks from x to y
217
218              The program detected a mismatch  between  the  number  of  valid
219              directory entries referencing inode ino and the number of refer‐
220              ences recorded in the inode and corrected the the number in  the
221              inode.
222
223       fork-type fork in ino ino claims used block bno
224
225              Inode  ino  claims  a block bno that is used (claimed) by either
226              another inode or the filesystem itself for metadata storage. The
227              fork-type  is either data or attr indicating whether the problem
228              lies in the portion of the inode that tracks regular data or the
229              portion  of  the inode that stores XFS attributes.  If the inode
230              is a real-time (rt) inode, the message says so.  Any inode  that
231              claims blocks used by the filesystem is deleted.  If two or more
232              inodes claim the same block, they are both deleted.
233
234       fork-type fork in ino ino claims dup extent ...
235
236              Inode ino claims a block in an extent known to be  claimed  more
237              than  once.   The  offset  in the inode, start and length of the
238              extent is given.  The message is slightly different if the inode
239              is  a  real-time  (rt) inode and the extent is therefore a real-
240              time (rt) extent.
241
242       inode ino - bad extent ...
243
244              An extent record in the blockmap of inode ino claims blocks that
245              are  out of the legal range of the filesystem.  The message sup‐
246              plies the start, end, and file offset of the extent.   The  mes‐
247              sage  is  slightly  different  if the extent is a real-time (rt)
248              extent.
249
250       bad fork-type fork in inode ino
251
252              There was something structurally wrong or inconsistent with  the
253              data structures that map offsets to filesystem blocks.
254
255       cleared inode ino
256
257              There  was something wrong with the inode that was uncorrectable
258              so the program freed the inode.  This  usually  happens  because
259              the  inode  claims blocks that are used by something else or the
260              inode itself is badly corrupted. Typically, this message is pre‐
261              ceded by one or more messages indicating why the inode needed to
262              be cleared.
263
264       bad attribute fork in inode ino, clearing attr fork
265
266              There was something wrong with the portion  of  the  inode  that
267              stores  XFS attributes (the attribute fork) so the program reset
268              the attribute fork.  As a result of this, all attributes on that
269              inode are lost.
270
271       correcting nextents for inode ino, was x - counted y
272
273              The  program  found that the number of extents used to store the
274              data in the inode is wrong and corrected the number.   The  mes‐
275              sage  refers  to nextents if the count is wrong on the number of
276              extents used to store attribute information.
277
278       entry name in dir dir_ino not consistent with .. value  (xxxx)  in  dir
279       ino ino, junking entry name in directory inode dir_ino
280
281              The entry name in directory inode dir_ino references a directory
282              inode ino.  However, the .. entry  in  directory  ino  does  not
283              point  back  to  directory  dir_ino,  so the program deletes the
284              entry name in directory inode dir_ino.  If the  directory  inode
285              ino  winds up becoming a disconnected inode as a result of this,
286              it is moved to lost+found later.
287
288       entry name in dir dir_ino references already  connected  dir  ino  ino,
289       junking entry name in directory inode dir_ino
290
291              The  entry name in directory inode dir_ino points to a directory
292              inode ino that is known to be  a  child  of  another  directory.
293              Therefore,  the  entry  is invalid and is deleted.  This message
294              refers to an entry in a small directory.  If this were  a  large
295              directory, the last phrase would read "will clear entry".
296
297       entry references free inode ino in directory dir_ino, will clear entry
298
299              An entry in directory inode dir_ino references an inode ino that
300              is known to be free. The  entry  is  therefore  invalid  and  is
301              deleted.   This  message  refers  to  a large directory.  If the
302              directory were small, the  message  would  read  "junking  entry
303              ...".
304

EXIT STATUS

306       xfs_repair  -n (no modify node) will return a status of 1 if filesystem
307       corruption was detected and 0 if no filesystem corruption was detected.
308       xfs_repair  run  without the -n option will always return a status code
309       of 0.
310

BUGS

312       The filesystem to be checked and  repaired  must  have  been  unmounted
313       cleanly  using  normal  system administration procedures (the umount(8)
314       command or system shutdown), not as a  result  of  a  crash  or  system
315       reset.   If the filesystem has not been unmounted cleanly, mount it and
316       unmount it cleanly before running xfs_repair.
317
318       xfs_repair does not do a thorough job on XFS extended attributes.   The
319       structure  of  the attribute fork will be consistent, but only the con‐
320       tents of attribute forks that will fit into an inode are checked.  This
321       limitation will be fixed in the future.
322
323       The no-modify mode (-n option) is not completely accurate.  It does not
324       catch inconsistencies in the freespace  and  inode  maps,  particularly
325       lost blocks or subtly corrupted maps (trees).
326
327       The  no-modify mode can generate repeated warnings about the same prob‐
328       lems because it cannot fix the problems as they are encountered.
329
330       If a filesystem fails to be repaired, a metadump image can be generated
331       with  xfs_metadump(8)  and  be sent to an XFS maintainer to be analysed
332       and xfs_repair fixed and/or improved.
333

SEE ALSO

335       dd(1), mkfs.xfs(8), umount(8), xfs_check(8), xfs_metadump(8), xfs(5).
336
337
338
339                                                                 xfs_repair(8)
Impressum