]>
Commit | Line | Data |
---|---|---|
3839e657 | 1 | .\" -*- nroff -*- |
50e1e10f TT |
2 | .\" Copyright 1993, 1994, 1995 by Theodore Ts'o. All Rights Reserved. |
3 | .\" This file may be copied under the terms of the GNU Public License. | |
dba2bbdf | 4 | .\" |
74becf3c | 5 | .TH DEBUGFS 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@" |
3839e657 | 6 | .SH NAME |
4f858546 | 7 | debugfs \- ext2/ext3/ext4 file system debugger |
3839e657 TT |
8 | .SH SYNOPSIS |
9 | .B debugfs | |
10 | [ | |
9bca9a39 | 11 | .B \-DVwcin |
1ad54a94 TT |
12 | ] |
13 | [ | |
2e8d40d5 TT |
14 | .B \-b |
15 | blocksize | |
16 | ] | |
17 | [ | |
18 | .B \-s | |
19 | superblock | |
20 | ] | |
21 | [ | |
dba2bbdf | 22 | .B \-f |
fc6d9d51 TT |
23 | cmd_file |
24 | ] | |
25 | [ | |
26 | .B \-R | |
27 | request | |
28 | ] | |
29 | [ | |
1ad54a94 TT |
30 | .B \-d |
31 | data_source_device | |
59cf7e0d TT |
32 | ] |
33 | [ | |
491cc33a DW |
34 | .B \-z |
35 | .I undo_file | |
36 | ] | |
37 | [ | |
3839e657 TT |
38 | device |
39 | ] | |
40 | .SH DESCRIPTION | |
dba2bbdf AD |
41 | The |
42 | .B debugfs | |
6e96adcb | 43 | program is an interactive file system debugger. It can be used to |
4f858546 | 44 | examine and change the state of an ext2, ext3, or ext4 file system. |
a9a81b1f | 45 | .PP |
3839e657 | 46 | .I device |
a9a81b1f | 47 | is a block device (e.g., /dev/sdXX) or a file containing the file system. |
3839e657 TT |
48 | .SH OPTIONS |
49 | .TP | |
59cf7e0d | 50 | .I \-w |
583ccdc3 TT |
51 | Specifies that the file system should be opened in read-write mode. |
52 | Without this option, the file system is opened in read-only mode. | |
fc6d9d51 | 53 | .TP |
9bca9a39 DW |
54 | .I \-n |
55 | Disables metadata checksum verification. This should only be used if | |
56 | you believe the metadata to be correct despite the complaints of | |
57 | e2fsprogs. | |
58 | .TP | |
59cf7e0d | 59 | .I \-c |
2e8d40d5 TT |
60 | Specifies that the file system should be opened in catastrophic mode, in |
61 | which the inode and group bitmaps are not read initially. This can be | |
62 | useful for filesystems with significant corruption, but because of this, | |
63 | catastrophic mode forces the filesystem to be opened read-only. | |
64 | .TP | |
59cf7e0d | 65 | .I \-i |
dba2bbdf | 66 | Specifies that |
59cf7e0d TT |
67 | .I device |
68 | represents an ext2 image file created by the | |
69 | .B e2image | |
70 | program. Since the ext2 image file only contains the superblock, block | |
dba2bbdf | 71 | group descriptor, block and inode allocation bitmaps, and |
59cf7e0d TT |
72 | the inode table, many |
73 | .B debugfs | |
dba2bbdf | 74 | commands will not function properly. |
59cf7e0d | 75 | .B Warning: |
dba2bbdf AD |
76 | no safety checks are in place, and |
77 | .B debugfs | |
59cf7e0d | 78 | may fail in interesting ways if commands such as |
dba2bbdf AD |
79 | .IR ls ", " dump ", " |
80 | etc. are tried without specifying the | |
1ad54a94 | 81 | .I data_source_device |
dba2bbdf | 82 | using the |
1ad54a94 TT |
83 | .I \-d |
84 | option. | |
dba2bbdf | 85 | .B debugfs |
59cf7e0d TT |
86 | is a debugging tool. It has rough edges! |
87 | .TP | |
1ad54a94 | 88 | .I -d data_source_device |
dba2bbdf | 89 | Used with the |
1ad54a94 TT |
90 | .I \-i |
91 | option, specifies that | |
92 | .I data_source_device | |
93 | should be used when reading blocks not found in the ext2 image file. | |
94 | This includes data, directory, and indirect blocks. | |
95 | .TP | |
2e8d40d5 | 96 | .I -b blocksize |
edc7b098 TT |
97 | Forces the use of the given block size (in bytes) for the file system, |
98 | rather than detecting the correct block size automatically. (This | |
99 | option is rarely needed; it is used primarily when the file system is | |
100 | extremely badly damaged/corrupted.) | |
2e8d40d5 TT |
101 | .TP |
102 | .I -s superblock | |
054cd1f6 TT |
103 | Causes the file system superblock to be read from the given block |
104 | number, instead of using the primary superblock (located at an offset of | |
105 | 1024 bytes from the beginning of the filesystem). If you specify the | |
2e8d40d5 | 106 | .I -s |
054cd1f6 | 107 | option, you must also provide the blocksize of the filesystem via the |
2e8d40d5 | 108 | .I -b |
edc7b098 TT |
109 | option. (This |
110 | option is rarely needed; it is used primarily when the file system is | |
111 | extremely badly damaged/corrupted.) | |
2e8d40d5 | 112 | .TP |
fc6d9d51 | 113 | .I -f cmd_file |
dba2bbdf | 114 | Causes |
fc6d9d51 | 115 | .B debugfs |
dba2bbdf AD |
116 | to read in commands from |
117 | .IR cmd_file , | |
118 | and execute them. When | |
fc6d9d51 | 119 | .B debugfs |
583ccdc3 | 120 | is finished executing those commands, it will exit. |
0fd68e02 TT |
121 | .TP |
122 | .I -D | |
123 | Causes | |
124 | .B debugfs | |
125 | to open the device using Direct I/O, bypassing the buffer cache. Note | |
126 | that some Linux devices, notably device mapper as of this writing, do | |
127 | not support Direct I/O. | |
128 | .TP | |
fc6d9d51 | 129 | .I -R request |
dba2bbdf | 130 | Causes |
fc6d9d51 | 131 | .B debugfs |
dba2bbdf | 132 | to execute the single command |
fc6d9d51 TT |
133 | .IR request , |
134 | and then exit. | |
818180cd TT |
135 | .TP |
136 | .I -V | |
dba2bbdf | 137 | print the version number of |
818180cd TT |
138 | .B debugfs |
139 | and exit. | |
491cc33a DW |
140 | .TP |
141 | .BI \-z " undo_file" | |
142 | Before overwriting a file system block, write the old contents of the block to | |
143 | an undo file. This undo file can be used with e2undo(8) to restore the old | |
144 | contents of the file system should something go wrong. If the empty string is | |
145 | passed as the undo_file argument, the undo file will be written to a file named | |
7600aa0f | 146 | debugfs-\fIdevice\fR.e2undo in the directory specified via the |
491cc33a DW |
147 | \fIE2FSPROGS_UNDO_DIR\fR environment variable. |
148 | ||
149 | WARNING: The undo file cannot be used to recover from a power or system crash. | |
6e96adcb TT |
150 | .SH SPECIFYING FILES |
151 | Many | |
152 | .B debugfs | |
153 | commands take a | |
154 | .I filespec | |
dba2bbdf AD |
155 | as an argument to specify an inode (as opposed to a pathname) |
156 | in the filesystem which is currently opened by | |
157 | .BR debugfs . | |
6e96adcb TT |
158 | The |
159 | .I filespec | |
dba2bbdf AD |
160 | argument may be specified in two forms. The first form is an inode |
161 | number surrounded by angle brackets, e.g., | |
6e96adcb TT |
162 | .IR <2> . |
163 | The second form is a pathname; if the pathname is prefixed by a forward slash | |
dba2bbdf AD |
164 | ('/'), then it is interpreted relative to the root of the filesystem |
165 | which is currently opened by | |
166 | .BR debugfs . | |
167 | If not, the pathname is | |
168 | interpreted relative to the current working directory as maintained by | |
6e96adcb | 169 | .BR debugfs . |
dba2bbdf | 170 | This may be modified by using the |
6e96adcb TT |
171 | .B debugfs |
172 | command | |
173 | .IR cd . | |
dba2bbdf | 174 | .\" |
6e96adcb TT |
175 | .\" |
176 | .\" | |
3839e657 | 177 | .SH COMMANDS |
dba2bbdf | 178 | This is a list of the commands which |
3839e657 | 179 | .B debugfs |
6e96adcb | 180 | supports. |
3839e657 | 181 | .TP |
c890dbb2 | 182 | .BI blocks " filespec" |
af0df2aa TT |
183 | Print the blocks used by the inode |
184 | .I filespec | |
185 | to stdout. | |
186 | .TP | |
9ed2c124 TT |
187 | .BI bmap " [ -a ] filespec logical_block [physical_block]" |
188 | Print or set the physical block number corresponding to the logical block number | |
becf36f6 TT |
189 | .I logical_block |
190 | in the inode | |
191 | .IR filespec . | |
9ed2c124 | 192 | If the |
c7c99af6 | 193 | .I \-a |
9ed2c124 | 194 | flag is specified, try to allocate a block if necessary. |
becf36f6 | 195 | .TP |
c7c99af6 | 196 | .BI block_dump " '[ -x ] [-f filespec] block_num" |
dba2bbdf AD |
197 | Dump the filesystem block given by |
198 | .I block_num | |
199 | in hex and ASCII format to the console. If the | |
c7c99af6 | 200 | .I \-f |
dba2bbdf AD |
201 | option is specified, the block number is relative to the start of the given |
202 | .BR filespec . | |
c7c99af6 TT |
203 | If the |
204 | .I \-x | |
205 | option is specified, the block is interpreted as an extended attribute | |
206 | block and printed to show the structure of extended attribute data | |
207 | structures. | |
85a24385 | 208 | .TP |
dba2bbdf AD |
209 | .BI cat " filespec" |
210 | Dump the contents of the inode | |
fc6d9d51 TT |
211 | .I filespec |
212 | to stdout. | |
3839e657 | 213 | .TP |
dba2bbdf AD |
214 | .BI cd " filespec" |
215 | Change the current working directory to | |
fc6d9d51 | 216 | .IR filespec . |
50e1e10f | 217 | .TP |
dba2bbdf AD |
218 | .BI chroot " filespec" |
219 | Change the root directory to be the directory | |
fc6d9d51 | 220 | .IR filespec . |
3839e657 | 221 | .TP |
dba2bbdf AD |
222 | .BI close " [-a]" |
223 | Close the currently open file system. If the | |
6dce5328 TT |
224 | .I -a |
225 | option is specified, write out any changes to the superblock and block | |
226 | group descriptors to all of the backup superblocks, not just to the | |
227 | master superblock. | |
3839e657 | 228 | .TP |
dba2bbdf AD |
229 | .BI clri " filespec" |
230 | Clear the contents of the inode | |
231 | .IR filespec . | |
fc6d9d51 | 232 | .TP |
b1992919 | 233 | .BI copy_inode " source_inode destination_inode" |
ce20096f | 234 | Copy the contents of the inode structure in |
b1992919 TT |
235 | .I source_inode |
236 | and use it to overwrite the inode structure at | |
237 | .IR destination_inode . | |
238 | .TP | |
dba2bbdf | 239 | .BI dirsearch " filespec filename" |
f5ae5b3a ES |
240 | Search the directory |
241 | .I filespec | |
242 | for | |
243 | .IR filename . | |
244 | .TP | |
7600aa0f | 245 | .BI dirty " [-clean]" |
dba2bbdf | 246 | Mark the filesystem as dirty, so that the superblocks will be written on exit. |
7600aa0f TN |
247 | Additionally, clear the superblock's valid flag, or set it if |
248 | .I -clean | |
249 | is specified. | |
dba2bbdf AD |
250 | .TP |
251 | .BI dump " [-p] filespec out_file" | |
252 | Dump the contents of the inode | |
fc6d9d51 | 253 | .I filespec |
dba2bbdf AD |
254 | to the output file |
255 | .IR out_file . | |
256 | If the | |
257 | .I -p | |
258 | option is given set the owner, group and permissions information on | |
259 | .I out_file | |
260 | to match | |
fc6d9d51 TT |
261 | .IR filespec . |
262 | .TP | |
2fe6136c AD |
263 | .BI dump_mmp " [mmp_block]" |
264 | Display the multiple-mount protection (mmp) field values. If | |
265 | .I mmp_block | |
266 | is specified then verify and dump the MMP values from the given block | |
267 | number, otherwise use the | |
268 | .B s_mmp_block | |
269 | field in the superblock to locate and use the existing MMP block. | |
3859977a | 270 | .TP |
dba2bbdf | 271 | .BI dx_hash " [-h hash_alg] [-s hash_seed] filename" |
f5ae5b3a ES |
272 | Calculate the directory hash of |
273 | .IR filename . | |
274 | The hash algorithm specified with | |
275 | .I -h | |
dba2bbdf AD |
276 | may be |
277 | .BR legacy , " half_md4" ", or " tea . | |
f5ae5b3a ES |
278 | The hash seed specified with |
279 | .I -s | |
280 | must be in UUID format. | |
281 | .TP | |
dba2bbdf | 282 | .BI dump_extents " [-n] [-l] filespec" |
187cb623 TT |
283 | Dump the the extent tree of the inode |
284 | .IR filespec . | |
dba2bbdf | 285 | The |
187cb623 TT |
286 | .I -n |
287 | flag will cause | |
dba2bbdf | 288 | .B dump_extents |
187cb623 | 289 | to only display the interior nodes in the extent tree. The |
dba2bbdf AD |
290 | .I -l |
291 | flag will cause | |
292 | .B dump_extents | |
187cb623 TT |
293 | to only display the leaf nodes in the extent tree. |
294 | .IP | |
295 | (Please note that the length and range of blocks for the last extent in | |
296 | an interior node is an estimate by the extents library functions, and is | |
d4a93302 | 297 | not stored in filesystem data structures. Hence, the values displayed |
dba2bbdf | 298 | may not necessarily by accurate and does not indicate a problem or |
187cb623 TT |
299 | corruption in the file system.) |
300 | .TP | |
7600aa0f TN |
301 | .B dump_unused |
302 | Dump unused blocks which contain non-null bytes. | |
303 | .TP | |
304 | .BI ea_get " [-f outfile]|[-xVC] [-r] filespec attr_name" | |
cac40d06 DW |
305 | Retrieve the value of the extended attribute |
306 | .I attr_name | |
307 | in the file | |
308 | .I filespec | |
309 | and write it either to stdout or to \fIoutfile\fR. | |
310 | .TP | |
311 | .BI ea_list " filespec | |
312 | List the extended attributes associated with the file | |
313 | .I filespec | |
314 | to standard output. | |
315 | .TP | |
7600aa0f | 316 | .BI ea_set " [-f infile] [-r] filespec attr_name attr_value |
cac40d06 DW |
317 | Set the value of the extended attribute |
318 | .I attr_name | |
319 | in the file | |
320 | .I filespec | |
321 | to the string value | |
322 | .I attr_value | |
323 | or read it from \fIinfile\fR. | |
324 | .TP | |
325 | .BI ea_rm " filespec attr_names... | |
326 | Remove the extended attribute | |
327 | .I attr_name | |
328 | from the file \fIfilespec\fR. | |
329 | .TP | |
dba2bbdf | 330 | .BI expand_dir " filespec" |
fc6d9d51 TT |
331 | Expand the directory |
332 | .IR filespec . | |
3839e657 | 333 | .TP |
2f8c0d02 DW |
334 | .BI fallocate " filespec start_block [end_block] |
335 | Allocate and map uninitialized blocks into \fIfilespec\fR between | |
336 | logical block \fIstart_block\fR and \fIend_block\fR, inclusive. If | |
337 | \fIend_block\fR is not supplied, this function maps until it runs out | |
338 | of free disk blocks or the maximum file size is reached. Existing | |
339 | mappings are left alone. | |
340 | .TP | |
dba2bbdf | 341 | .BI feature " [fs_feature] [-fs_feature] ..." |
d3aea7dc TT |
342 | Set or clear various filesystem features in the superblock. After setting |
343 | or clearing any filesystem features that were requested, print the current | |
344 | state of the filesystem feature set. | |
345 | .TP | |
dba2bbdf | 346 | .BI filefrag " [-dvr] filespec" |
c4ab66c5 TT |
347 | Print the number of contiguous extents in |
348 | .IR filespec . | |
349 | If | |
350 | .I filespec | |
351 | is a directory and the | |
352 | .I -d | |
353 | option is not specified, | |
354 | .I filefrag | |
355 | will print the number of contiguous extents for each file in | |
356 | the directory. The | |
357 | .I -v | |
358 | option will cause | |
359 | .I filefrag | |
360 | print a tabular listing of the contiguous extents in the | |
361 | file. The | |
362 | .I -r | |
363 | option will cause | |
364 | .I filefrag | |
365 | to do a recursive listing of the directory. | |
366 | .TP | |
dba2bbdf AD |
367 | .BI find_free_block " [count [goal]]" |
368 | Find the first | |
e1018eea TT |
369 | .I count |
370 | free blocks, starting from | |
3839e657 | 371 | .I goal |
dba2bbdf AD |
372 | and allocate it. Also available as |
373 | .BR ffb . | |
3839e657 | 374 | .TP |
dba2bbdf AD |
375 | .BI find_free_inode " [dir [mode]]" |
376 | Find a free inode and allocate it. If present, | |
fc6d9d51 | 377 | .I dir |
dba2bbdf AD |
378 | specifies the inode number of the directory |
379 | which the inode is to be located. The second | |
fc6d9d51 TT |
380 | optional argument |
381 | .I mode | |
382 | specifies the permissions of the new inode. (If the directory bit is set | |
dba2bbdf AD |
383 | on the mode, the allocation routine will function differently.) Also |
384 | available as | |
385 | .BR ffi . | |
fc6d9d51 | 386 | .TP |
dba2bbdf | 387 | .BI freeb " block [count]" |
fc6d9d51 TT |
388 | Mark the block number |
389 | .I block | |
390 | as not allocated. | |
dba2bbdf AD |
391 | If the optional argument |
392 | .I count | |
393 | is present, then | |
e1018eea TT |
394 | .I count |
395 | blocks starting at block number | |
396 | .I block | |
397 | will be marked as not allocated. | |
fc6d9d51 | 398 | .TP |
dba2bbdf | 399 | .BI freefrag " [-c chunk_kb]" |
5e96c572 TT |
400 | Report free space fragmentation on the currently open file system. |
401 | If the | |
402 | .I \-c | |
403 | option is specified then the filefrag command will print how many free | |
404 | chunks of size | |
405 | .I chunk_kb | |
406 | can be found in the file system. The chunk size must be a power of two | |
407 | and be larger than the file system block size. | |
408 | .TP | |
dba2bbdf AD |
409 | .BI freei " filespec [num]" |
410 | Free the inode specified by | |
583ccdc3 | 411 | .IR filespec . |
2ae5d1fd TT |
412 | If |
413 | .I num | |
414 | is specified, also clear num-1 inodes after the specified inode. | |
3839e657 | 415 | .TP |
7600aa0f TN |
416 | .BI get_quota " quota_type id" |
417 | Display quota information for given quota type (user, group, or project) and ID. | |
418 | .TP | |
dba2bbdf AD |
419 | .B help |
420 | Print a list of commands understood by | |
0fd68e02 | 421 | .BR debugfs . |
50e1e10f | 422 | .TP |
dba2bbdf | 423 | .BI htree_dump " filespec" |
f5ae5b3a ES |
424 | Dump the hash-indexed directory |
425 | .IR filespec , | |
426 | showing its tree structure. | |
427 | .TP | |
dba2bbdf | 428 | .BI icheck " block ..." |
583ccdc3 | 429 | Print a listing of the inodes which use the one or more blocks specified |
fc6d9d51 | 430 | on the command line. |
3839e657 | 431 | .TP |
c7c99af6 | 432 | .BI inode_dump " [-b]|[-e]|[-x] filespec" |
e13ebfdd | 433 | Print the contents of the inode data structure in hex and ASCII format. |
dd1543db TT |
434 | The |
435 | .I \-b | |
436 | option causes the command to only dump the contents of the | |
437 | .B i_blocks | |
438 | array. The | |
439 | .I \-e | |
440 | option causes the command to only dump the contents of the extra inode | |
c7c99af6 TT |
441 | space, which is used to store in-line extended attributes. The |
442 | .I \-x | |
443 | option causes the command to dump the extra inode space interpreted and | |
444 | extended attributes. This is useful to debug corrupted inodes | |
445 | containing extended attributes. | |
e13ebfdd | 446 | .TP |
dba2bbdf AD |
447 | .BI imap " filespec" |
448 | Print the location of the inode data structure (in the inode table) | |
becf36f6 TT |
449 | of the inode |
450 | .IR filespec . | |
451 | .TP | |
dba2bbdf | 452 | .BI init_filesys " device blocksize" |
3839e657 TT |
453 | Create an ext2 file system on |
454 | .I device | |
fc6d9d51 TT |
455 | with device size |
456 | .IR blocksize . | |
dba2bbdf AD |
457 | Note that this does not fully initialize all of the data structures; |
458 | to do this, use the | |
fc6d9d51 TT |
459 | .BR mke2fs (8) |
460 | program. This is just a call to the low-level library, which sets up | |
461 | the superblock and block descriptors. | |
462 | .TP | |
cac40d06 DW |
463 | .BI journal_close |
464 | Close the open journal. | |
465 | .TP | |
7600aa0f | 466 | .BI journal_open " [-c] [-v ver] [-f ext_jnl] |
cac40d06 DW |
467 | Opens the journal for reading and writing. Journal checksumming can |
468 | be enabled by supplying \fI-c\fR; checksum formats 2 and 3 can be | |
469 | selected with the \fI-v\fR option. An external journal can be loaded | |
470 | from \fIext_jnl\fR. | |
471 | .TP | |
472 | .BI journal_run | |
473 | Replay all transactions in the open journal. | |
474 | .TP | |
475 | .BI journal_write " [-b blocks] [-r revoke] [-c] file | |
476 | Write a transaction to the open journal. The list of blocks to write | |
477 | should be supplied as a comma-separated list in \fIblocks\fR; the | |
478 | blocks themselves should be readable from \fIfile\fR. A list of | |
479 | blocks to revoke can be supplied as a comma-separated list in | |
480 | \fIrevoke\fR. By default, a commit record is written at the end; the | |
481 | \fI-c\fR switch writes an uncommitted transaction. | |
482 | .TP | |
dba2bbdf AD |
483 | .BI kill_file " filespec" |
484 | Deallocate the inode | |
fc6d9d51 TT |
485 | .I filespec |
486 | and its blocks. Note that this does not remove any directory | |
dba2bbdf | 487 | entries (if any) to this inode. See the |
583ccdc3 | 488 | .BR rm (1) |
fc6d9d51 TT |
489 | command if you wish to unlink a file. |
490 | .TP | |
dba2bbdf | 491 | .BI lcd " directory" |
6e96adcb TT |
492 | Change the current working directory of the |
493 | .B debugfs | |
494 | process to | |
495 | .I directory | |
496 | on the native filesystem. | |
497 | .TP | |
7600aa0f TN |
498 | .BI list_quota " quota_type" |
499 | Display quota information for given quota type (user, group, or project). | |
500 | .TP | |
dba2bbdf AD |
501 | .BI ln " filespec dest_file" |
502 | Create a link named | |
fc6d9d51 | 503 | .I dest_file |
dba2bbdf | 504 | which is a hard link to |
fc6d9d51 TT |
505 | .IR filespec . |
506 | Note this does not adjust the inode reference counts. | |
507 | .TP | |
7600aa0f | 508 | .BI logdump " [-acsOS] [-b block] [-i filespec] [-f journal_file] [output_file]" |
dba2bbdf AD |
509 | Dump the contents of the ext3 journal. By default, dump the journal inode as |
510 | specified in the superblock. However, this can be overridden with the | |
a435ec34 | 511 | .I \-i |
dba2bbdf AD |
512 | option, which dumps the journal from the internal inode given by |
513 | .IR filespec . | |
514 | A regular file containing journal data can be specified using the | |
a435ec34 | 515 | .I \-f |
dba2bbdf | 516 | option. Finally, the |
a435ec34 TT |
517 | .I \-s |
518 | option utilizes the backup information in the superblock to locate the | |
519 | journal. | |
520 | .IP | |
dba2bbdf | 521 | The |
7600aa0f TN |
522 | .I \-S |
523 | option causes | |
524 | .B logdump | |
525 | to print the contents of the journal superblock. | |
526 | .IP | |
527 | The | |
a435ec34 | 528 | .I \-a |
dba2bbdf AD |
529 | option causes the |
530 | .B logdump | |
a435ec34 | 531 | program to print the contents of all of the descriptor blocks. |
dba2bbdf | 532 | The |
a435ec34 | 533 | .I \-b |
dba2bbdf AD |
534 | option causes |
535 | .B logdump | |
7600aa0f | 536 | to print all journal records that refer to the specified block. |
dba2bbdf | 537 | The |
a435ec34 TT |
538 | .I \-c |
539 | option will print out the contents of all of the data blocks selected by | |
dba2bbdf | 540 | the |
a435ec34 | 541 | .I \-a |
dba2bbdf | 542 | and |
a435ec34 TT |
543 | .I \-b |
544 | options. | |
46272d5a DW |
545 | .IP |
546 | The | |
547 | .I \-O | |
548 | option causes logdump to display old (checkpointed) journal entries. | |
549 | This can be used to try to track down journal problems even after the | |
550 | journal has been replayed. | |
6e96adcb | 551 | .TP |
68a1de3d | 552 | .BI ls " [-l] [-c] [-d] [-p] [-r] filespec" |
fc6d9d51 TT |
553 | Print a listing of the files in the directory |
554 | .IR filespec . | |
e1018eea | 555 | The |
41bf5993 TT |
556 | .I \-c |
557 | flag causes directory block checksums (if present) to be displayed. | |
558 | The | |
e1018eea TT |
559 | .I \-d |
560 | flag will list deleted entries in the directory. | |
dba2bbdf AD |
561 | The |
562 | .I \-l | |
563 | flag will list files using a more verbose format. | |
564 | The | |
d056b991 TT |
565 | .I \-p |
566 | flag will list the files in a format which is more easily parsable by | |
567 | scripts, as well as making it more clear when there are spaces or other | |
711d3846 | 568 | non-printing characters at the end of filenames. |
68a1de3d TT |
569 | The |
570 | .I \-r | |
571 | flag will force the printing of the filename, even if it is encrypted. | |
fc6d9d51 | 572 | .TP |
2d8637b1 TT |
573 | .BI list_deleted_inodes " [limit]" |
574 | List deleted inodes, optionally limited to those deleted within | |
575 | .I limit | |
576 | seconds ago. Also available as | |
577 | .BR lsdel . | |
578 | .IP | |
579 | This command was useful for recovering from accidental file deletions | |
580 | for ext2 file systems. Unfortunately, it is not useful for this purpose | |
581 | if the files were deleted using ext3 or ext4, since the inode's | |
582 | data blocks are no longer available after the inode is released. | |
583 | .TP | |
dba2bbdf | 584 | .BI modify_inode " filespec" |
fc6d9d51 TT |
585 | Modify the contents of the inode structure in the inode |
586 | .IR filespec . | |
dba2bbdf AD |
587 | Also available as |
588 | .BR mi . | |
fc6d9d51 | 589 | .TP |
dba2bbdf | 590 | .BI mkdir " filespec" |
3839e657 TT |
591 | Make a directory. |
592 | .TP | |
dba2bbdf | 593 | .BI mknod " filespec [p|[[c|b] major minor]]" |
fc6d9d51 | 594 | Create a special device file (a named pipe, character or block device). |
dba2bbdf | 595 | If a character or block device is to be made, the |
fc6d9d51 TT |
596 | .I major |
597 | and | |
598 | .I minor | |
599 | device numbers must be specified. | |
50e1e10f | 600 | .TP |
dba2bbdf | 601 | .BI ncheck " [-c] inode_num ..." |
583ccdc3 | 602 | Take the requested list of inode numbers, and print a listing of pathnames |
8bf1e918 TT |
603 | to those inodes. The |
604 | .I -c | |
605 | flag will enable checking the file type information in the directory | |
606 | entry to make sure it matches the inode's type. | |
50e1e10f | 607 | .TP |
7600aa0f | 608 | .BI open " [-weficD] [-b blocksize] [-d image_filename] [-s superblock] [-z undo_file] device" |
dba2bbdf AD |
609 | Open a filesystem for editing. The |
610 | .I -f | |
611 | flag forces the filesystem to be opened even if there are some unknown | |
612 | or incompatible filesystem features which would normally | |
2e8d40d5 | 613 | prevent the filesystem from being opened. The |
98eb44bd TT |
614 | .I -e |
615 | flag causes the filesystem to be opened in exclusive mode. The | |
7600aa0f | 616 | .IR -b ", " -c ", " -d ", " -i ", " -s ", " -w ", and " -D |
dba2bbdf | 617 | options behave the same as the command-line options to |
98eb44bd | 618 | .BR debugfs . |
3839e657 | 619 | .TP |
dba2bbdf | 620 | .BI punch " filespec start_blk [end_blk]" |
86685923 TT |
621 | Delete the blocks in the inode ranging from |
622 | .I start_blk | |
623 | to | |
624 | .IR end_blk . | |
625 | If | |
626 | .I end_blk | |
627 | is omitted then this command will function as a truncate command; that | |
628 | is, all of the blocks starting at | |
629 | .I start_blk | |
630 | through to the end of the file will be deallocated. | |
631 | .TP | |
2d8637b1 | 632 | .BI symlink " filespec target" |
4df6a37b DH |
633 | Make a symbolic link. |
634 | .TP | |
dba2bbdf | 635 | .B pwd |
50e1e10f | 636 | Print the current working directory. |
3839e657 | 637 | .TP |
dba2bbdf | 638 | .B quit |
3839e657 TT |
639 | Quit |
640 | .B debugfs | |
641 | .TP | |
b6edbf6b | 642 | .BI rdump " directory[...] destination" |
6e96adcb | 643 | Recursively dump |
b6edbf6b AC |
644 | .IR directory , |
645 | or multiple | |
646 | .IR directories , | |
6e96adcb TT |
647 | and all its contents (including regular files, symbolic links, and other |
648 | directories) into the named | |
b6edbf6b | 649 | .IR destination , |
6e96adcb TT |
650 | which should be an existing directory on the native filesystem. |
651 | .TP | |
dba2bbdf AD |
652 | .BI rm " pathname" |
653 | Unlink | |
fc6d9d51 | 654 | .IR pathname . |
dba2bbdf | 655 | If this causes the inode pointed to by |
fc6d9d51 TT |
656 | .I pathname |
657 | to have no other references, deallocate the file. This command functions | |
658 | as the unlink() system call. | |
dba2bbdf | 659 | .I |
fc6d9d51 | 660 | .TP |
dba2bbdf | 661 | .BI rmdir " filespec" |
fc6d9d51 TT |
662 | Remove the directory |
663 | .IR filespec . | |
fc6d9d51 | 664 | .TP |
dba2bbdf | 665 | .BI setb " block [count]" |
fc6d9d51 TT |
666 | Mark the block number |
667 | .I block | |
668 | as allocated. | |
dba2bbdf AD |
669 | If the optional argument |
670 | .I count | |
671 | is present, then | |
e1018eea TT |
672 | .I count |
673 | blocks starting at block number | |
674 | .I block | |
675 | will be marked as allocated. | |
fc6d9d51 | 676 | .TP |
dba2bbdf | 677 | .BI set_block_group " bgnum field value" |
c7c1209e TT |
678 | Modify the block group descriptor specified by |
679 | .I bgnum | |
680 | so that the block group descriptor field | |
681 | .I field | |
682 | has value | |
dba2bbdf AD |
683 | .IR value . |
684 | Also available as | |
685 | .BR set_bg . | |
c7c1209e | 686 | .TP |
7600aa0f TN |
687 | .BI set_current_time " time" |
688 | Set current time in seconds since Unix epoch to use when setting filesystem | |
689 | fields. | |
690 | .TP | |
dba2bbdf AD |
691 | .BI seti " filespec [num]" |
692 | Mark inode | |
fc6d9d51 | 693 | .I filespec |
2ae5d1fd TT |
694 | as in use in the inode bitmap. If |
695 | .I num | |
696 | is specified, also set num-1 inodes after the specified inode. | |
3839e657 | 697 | .TP |
dba2bbdf AD |
698 | .BI set_inode_field " filespec field value" |
699 | Modify the inode specified by | |
7dec050a TT |
700 | .I filespec |
701 | so that the inode field | |
702 | .I field | |
dba2bbdf | 703 | has value |
7dec050a | 704 | .I value. |
dba2bbdf | 705 | The list of valid inode fields which can be set via this command |
7dec050a | 706 | can be displayed by using the command: |
1d3a9511 | 707 | .B set_inode_field -l |
dba2bbdf AD |
708 | Also available as |
709 | .BR sif . | |
7dec050a | 710 | .TP |
dba2bbdf AD |
711 | .BI set_mmp_value " field value" |
712 | Modify the multiple-mount protection (MMP) data so that the MMP field | |
3859977a ES |
713 | .I field |
714 | has value | |
715 | .I value. | |
dba2bbdf | 716 | The list of valid MMP fields which can be set via this command |
3859977a ES |
717 | can be displayed by using the command: |
718 | .B set_mmp_value -l | |
dba2bbdf AD |
719 | Also available as |
720 | .BR smmp . | |
3859977a | 721 | .TP |
dba2bbdf | 722 | .BI set_super_value " field value" |
6e96adcb TT |
723 | Set the superblock field |
724 | .I field | |
dba2bbdf | 725 | to |
6e96adcb | 726 | .I value. |
dba2bbdf | 727 | The list of valid superblock fields which can be set via this command |
6e96adcb TT |
728 | can be displayed by using the command: |
729 | .B set_super_value -l | |
dba2bbdf AD |
730 | Also available as |
731 | .BR ssv . | |
6e96adcb | 732 | .TP |
7600aa0f TN |
733 | .B show_debugfs_params |
734 | Display | |
735 | .B debugfs | |
736 | parameters such as information about currently opened filesystem. | |
737 | .TP | |
dba2bbdf | 738 | .BI show_super_stats " [-h]" |
d3aea7dc TT |
739 | List the contents of the super block and the block group descriptors. If the |
740 | .I -h | |
dba2bbdf AD |
741 | flag is given, only print out the superblock contents. Also available as |
742 | .BR stats . | |
3839e657 | 743 | .TP |
dba2bbdf | 744 | .BI stat " filespec" |
fc6d9d51 TT |
745 | Display the contents of the inode structure of the inode |
746 | .IR filespec . | |
3839e657 | 747 | .TP |
7600aa0f TN |
748 | .B supported_features |
749 | Display filesystem features supported by this version of | |
750 | .BR debugfs . | |
751 | .TP | |
dba2bbdf | 752 | .BI testb " block [count]" |
fc6d9d51 TT |
753 | Test if the block number |
754 | .I block | |
755 | is marked as allocated in the block bitmap. | |
dba2bbdf AD |
756 | If the optional argument |
757 | .I count | |
758 | is present, then | |
e1018eea TT |
759 | .I count |
760 | blocks starting at block number | |
761 | .I block | |
762 | will be tested. | |
3839e657 | 763 | .TP |
dba2bbdf AD |
764 | .BI testi " filespec" |
765 | Test if the inode | |
fc6d9d51 TT |
766 | .I filespec |
767 | is marked as allocated in the inode bitmap. | |
3839e657 | 768 | .TP |
dba2bbdf | 769 | .BI undel " <inode_number> [pathname]" |
b026d539 TT |
770 | Undelete the specified inode number (which must be surrounded by angle |
771 | brackets) so that it and its blocks are marked in use, and optionally | |
dba2bbdf | 772 | link the recovered inode to the specified pathname. The |
b026d539 | 773 | .B e2fsck |
dba2bbdf | 774 | command should always be run after using the |
b026d539 TT |
775 | .B undel |
776 | command to recover deleted files. | |
777 | .IP | |
778 | Note that if you are recovering a large number of deleted files, linking | |
779 | the inode to a directory may require the directory to be expanded, which | |
780 | could allocate a block that had been used by one of the | |
dba2bbdf | 781 | yet-to-be-undeleted files. So it is safer to undelete all of the |
b026d539 TT |
782 | inodes without specifying a destination pathname, and then in a separate |
783 | pass, use the debugfs | |
784 | .B link | |
dba2bbdf | 785 | command to link the inode to the destination pathname, or use |
b026d539 TT |
786 | .B e2fsck |
787 | to check the filesystem and link all of the recovered inodes to the | |
711d3846 | 788 | lost+found directory. |
b026d539 | 789 | .TP |
dba2bbdf AD |
790 | .BI unlink " pathname" |
791 | Remove the link specified by | |
792 | .I pathname | |
fc6d9d51 | 793 | to an inode. Note this does not adjust the inode reference counts. |
50e1e10f | 794 | .TP |
dba2bbdf AD |
795 | .BI write " source_file out_file" |
796 | Copy the contents of | |
50e1e10f | 797 | .I source_file |
dba2bbdf AD |
798 | into a newly-created file in the filesystem named |
799 | .IR out_file . | |
85a24385 | 800 | .TP |
dba2bbdf | 801 | .BI zap_block " [-f filespec] [-o offset] [-l length] [-p pattern] block_num" |
dba2bbdf AD |
802 | Overwrite the block specified by |
803 | .I block_num | |
804 | with zero (NUL) bytes, or if | |
805 | .I -p | |
806 | is given use the byte specified by | |
807 | .IR pattern . | |
808 | If | |
809 | .I -f | |
810 | is given then | |
811 | .I block_num | |
812 | is relative to the start of the file given by | |
813 | .IR filespec . | |
814 | The | |
815 | .I -o | |
816 | and | |
817 | .I -l | |
818 | options limit the range of bytes to zap to the specified | |
819 | .I offset | |
820 | and | |
821 | .I length | |
822 | relative to the start of the block. | |
823 | .TP | |
824 | .BI zap_block " [-f filespec] [-b bit] block_num" | |
825 | Bit-flip portions of the physical | |
826 | .IR block_num . | |
827 | If | |
828 | .I -f | |
829 | is given, then | |
830 | .I block_num | |
831 | is a logical block relative to the start of | |
832 | .IR filespec . | |
2b5ddd75 TT |
833 | .SH ENVIRONMENT VARIABLES |
834 | .TP | |
835 | .B DEBUGFS_PAGER, PAGER | |
836 | The | |
0fd68e02 | 837 | .B debugfs |
2b5ddd75 | 838 | program always pipes the output of the some commands through a |
dba2bbdf AD |
839 | pager program. These commands include: |
840 | .IR show_super_stats " (" stats ), | |
841 | .IR list_directory " (" ls ), | |
842 | .IR show_inode_info " (" stat ), | |
843 | .IR list_deleted_inodes " (" lsdel ), | |
2b5ddd75 TT |
844 | and |
845 | .IR htree_dump . | |
846 | The specific pager can explicitly specified by the | |
847 | .B DEBUGFS_PAGER | |
848 | environment variable, and if it is not set, by the | |
849 | .B PAGER | |
dba2bbdf | 850 | environment variable. |
2b5ddd75 | 851 | .IP |
dba2bbdf | 852 | Note that since a pager is always used, the |
2b5ddd75 TT |
853 | .BR less (1) |
854 | pager is not particularly appropriate, since it clears the screen before | |
855 | displaying the output of the command and clears the output the screen | |
dba2bbdf | 856 | when the pager is exited. Many users prefer to use the |
2b5ddd75 | 857 | .BR less (1) |
dba2bbdf AD |
858 | pager for most purposes, which is why the |
859 | .B DEBUGFS_PAGER | |
2b5ddd75 TT |
860 | environment variable is available to override the more general |
861 | .B PAGER | |
862 | environment variable. | |
3839e657 TT |
863 | .SH AUTHOR |
864 | .B debugfs | |
50e1e10f | 865 | was written by Theodore Ts'o <tytso@mit.edu>. |
3839e657 TT |
866 | .SH SEE ALSO |
867 | .BR dumpe2fs (8), | |
0fd2f900 | 868 | .BR tune2fs (8), |
3839e657 | 869 | .BR e2fsck (8), |
3c22bf7e TT |
870 | .BR mke2fs (8), |
871 | .BR ext4 (5) |