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