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