no safety checks are in place, and
.B debugfs
may fail in interesting ways if commands such as
-.IR ls ", " dump ", "
+.IR ls ", " dump ,
etc. are tried without specifying the
.I data_source_device
using the
.B debugfs
is a debugging tool. It has rough edges!
.TP
-.I -d data_source_device
+.I \-d data_source_device
Used with the
.I \-i
option, specifies that
should be used when reading blocks not found in the ext2 image file.
This includes data, directory, and indirect blocks.
.TP
-.I -b blocksize
+.I \-b blocksize
Forces the use of the given block size (in bytes) for the file system,
rather than detecting the correct block size automatically. (This
option is rarely needed; it is used primarily when the file system is
extremely badly damaged/corrupted.)
.TP
-.I -s superblock
+.I \-s superblock
Causes the file system superblock to be read from the given block
number, instead of using the primary superblock (located at an offset of
1024 bytes from the beginning of the file system). If you specify the
-.I -s
+.I \-s
option, you must also provide the blocksize of the file system via the
-.I -b
+.I \-b
option. (This
option is rarely needed; it is used primarily when the file system is
extremely badly damaged/corrupted.)
.TP
-.I -f cmd_file
+.I \-f cmd_file
Causes
.B debugfs
to read in commands from
.B debugfs
is finished executing those commands, it will exit.
.TP
-.I -D
+.I \-D
Causes
.B debugfs
to open the device using Direct I/O, bypassing the buffer cache. Note
.IR request ,
and then exit.
.TP
-.I -V
+.I \-V
print the version number of
.B debugfs
and exit.
.TP
.BI \-z " undo_file"
Before overwriting a file system block, write the old contents of the block to
-an undo file. This undo file can be used with e2undo(8) to restore the old
+an undo file. This undo file can be used with
+.BR e2undo (8)
+to restore the old
contents of the file system should something go wrong. If the empty string is
passed as the undo_file argument, the undo file will be written to a file named
debugfs-\fIdevice\fR.e2undo in the directory specified via the
.I filespec
to stdout.
.TP
-.BI bmap " [ -a ] filespec logical_block [physical_block]"
+.BI bmap " [ \-a ] filespec logical_block [physical_block]"
Print or set the physical block number corresponding to the logical block number
.I logical_block
in the inode
.I \-a
flag is specified, try to allocate a block if necessary.
.TP
-.BI block_dump " '[ -x ] [-f filespec] block_num"
+.BI block_dump " '[ \-x ] [\-f filespec] block_num"
Dump the file system block given by
.I block_num
in hex and ASCII format to the console. If the
Change the root directory to be the directory
.IR filespec .
.TP
-.BI close " [-a]"
+.BI close " [\-a]"
Close the currently open file system. If the
-.I -a
+.I \-a
option is specified, write out any changes to the superblock and block
group descriptors to all of the backup superblocks, not just to the
master superblock.
for
.IR filename .
.TP
-.BI dirty " [-clean]"
+.BI dirty " [\-clean]"
Mark the file system as dirty, so that the superblocks will be written on exit.
Additionally, clear the superblock's valid flag, or set it if
.I -clean
is specified.
.TP
-.BI dump " [-p] filespec out_file"
+.BI dump " [\-p] filespec out_file"
Dump the contents of the inode
.I filespec
to the output file
.B s_mmp_block
field in the superblock to locate and use the existing MMP block.
.TP
-.BI dx_hash " [-cv] [-h hash_alg] [-s hash_seed] filename"
+.BI dx_hash " [\-cv] [\-h hash_alg] [\-s hash_seed] filename"
Calculate the directory hash of
.IR filename .
The
-.I -c
+.I \-c
option will casefold the filename before calculating the hash. The
-.I -v
+.I \-v
option will make the
.B dx_hash
command more verbose and print the hash algorithm and hash seed to
If a file system is open, use the hash_seed and
default hash_algorithm used by the file system, although these can be
overridden by the
-.I -h
+.I \-h
and
-.I -s
+.I \-s
options.
The hash algorithm specified with
-.I -h
+.I \-h
may be
.BR legacy , " half_md4" ", or " tea .
The hash seed specified with
-.I -s
+.I \-s
must be in UUID format.
.TP
-.BI dump_extents " [-n] [-l] filespec"
+.BI dump_extents " [\-n] [\-l] filespec"
Dump the extent tree of the inode
.IR filespec .
The
flag will cause
.B dump_extents
to only display the interior nodes in the extent tree. The
-.I -l
+.I \-l
flag will cause
.B dump_extents
to only display the leaf nodes in the extent tree.
.B dump_unused
Dump unused blocks which contain non-null bytes.
.TP
-.BI ea_get " [-f outfile]|[-xVC] [-r] filespec attr_name"
+.BI ea_get " [\-f outfile]|[\-xVC] [\-r] filespec attr_name"
Retrieve the value of the extended attribute
.I attr_name
in the file
.I filespec
and write it either to stdout or to \fIoutfile\fR.
.TP
-.BI ea_list " filespec
+.BI ea_list " filespec"
List the extended attributes associated with the file
.I filespec
to standard output.
.TP
-.BI ea_set " [-f infile] [-r] filespec attr_name attr_value
+.BI ea_set " [\-f infile] [\-r] filespec attr_name attr_value"
Set the value of the extended attribute
.I attr_name
in the file
.I attr_value
or read it from \fIinfile\fR.
.TP
-.BI ea_rm " filespec attr_names...
+.BI ea_rm " filespec attr_names..."
Remove the extended attribute
.I attr_name
from the file \fIfilespec\fR.
Expand the directory
.IR filespec .
.TP
-.BI fallocate " filespec start_block [end_block]
+.BI fallocate " filespec start_block [end_block]"
Allocate and map uninitialized blocks into \fIfilespec\fR between
logical block \fIstart_block\fR and \fIend_block\fR, inclusive. If
\fIend_block\fR is not supplied, this function maps until it runs out
of free disk blocks or the maximum file size is reached. Existing
mappings are left alone.
.TP
-.BI feature " [fs_feature] [-fs_feature] ..."
+.BI feature " [fs_feature] [\-fs_feature] ..."
Set or clear various file system features in the superblock. After setting
or clearing any file system features that were requested, print the current
state of the file system feature set.
.TP
-.BI filefrag " [-dvr] filespec"
+.BI filefrag " [\-dvr] filespec"
Print the number of contiguous extents in
.IR filespec .
If
.I filespec
is a directory and the
-.I -d
+.I \-d
option is not specified,
.I filefrag
will print the number of contiguous extents for each file in
the directory. The
-.I -v
+.I \-v
option will cause
.I filefrag
print a tabular listing of the contiguous extents in the
file. The
-.I -r
+.I \-r
option will cause
.I filefrag
to do a recursive listing of the directory.
.I block
will be marked as not allocated.
.TP
-.BI freefrag " [-c chunk_kb]"
+.BI freefrag " [\-c chunk_kb]"
Report free space fragmentation on the currently open file system.
If the
.I \-c
.IR filespec .
If
.I num
-is specified, also clear num-1 inodes after the specified inode.
+is specified, also clear num\-1 inodes after the specified inode.
.TP
.BI get_quota " quota_type id"
Display quota information for given quota type (user, group, or project) and ID.
Print a listing of the inodes which use the one or more blocks specified
on the command line.
.TP
-.BI inode_dump " [-b]|[-e]|[-x] filespec"
+.BI inode_dump " [\-b]|[\-e]|[\-x] filespec"
Print the contents of the inode data structure in hex and ASCII format.
The
.I \-b
program. This is just a call to the low-level library, which sets up
the superblock and block descriptors.
.TP
-.BI journal_close
+.B journal_close
Close the open journal.
.TP
-.BI journal_open " [-c] [-v ver] [-f ext_jnl]
+.BI journal_open " [\-c] [\-v ver] [\-f ext_jnl]"
Opens the journal for reading and writing. Journal checksumming can
-be enabled by supplying \fI-c\fR; checksum formats 2 and 3 can be
-selected with the \fI-v\fR option. An external journal can be loaded
+be enabled by supplying \fI\-c\fR; checksum formats 2 and 3 can be
+selected with the \fI\-v\fR option. An external journal can be loaded
from \fIext_jnl\fR.
.TP
-.BI journal_run
+.B journal_run
Replay all transactions in the open journal.
.TP
-.BI journal_write " [-b blocks] [-r revoke] [-c] file
+.BI journal_write " [\-b blocks] [\-r revoke] [\-c] file"
Write a transaction to the open journal. The list of blocks to write
should be supplied as a comma-separated list in \fIblocks\fR; the
blocks themselves should be readable from \fIfile\fR. A list of
blocks to revoke can be supplied as a comma-separated list in
\fIrevoke\fR. By default, a commit record is written at the end; the
-\fI-c\fR switch writes an uncommitted transaction.
+\fI\-c\fR switch writes an uncommitted transaction.
.TP
.BI kill_file " filespec"
Deallocate the inode
.IR filespec .
Note this does not adjust the inode reference counts.
.TP
-.BI logdump " [-acsOS] [-b block] [-n num_trans ] [-i filespec] [-f journal_file] [output_file]"
+.BI logdump " [\-acsOS] [\-b block] [\-n num_trans ] [\-i filespec] [\-f journal_file] [output_file]"
Dump the contents of the ext3 journal. By default, dump the journal inode as
specified in the superblock. However, this can be overridden with the
.I \-i
.I num_trans
transactions.
.TP
-.BI ls " [-l] [-c] [-d] [-p] [-r] filespec"
+.BI ls " [\-l] [\-c] [\-d] [\-p] [\-r] filespec"
Print a listing of the files in the directory
.IR filespec .
The
.I minor
device numbers must be specified.
.TP
-.BI ncheck " [-c] inode_num ..."
+.BI ncheck " [\-c] inode_num ..."
Take the requested list of inode numbers, and print a listing of pathnames
to those inodes. The
.I -c
flag will enable checking the file type information in the directory
entry to make sure it matches the inode's type.
.TP
-.BI open " [-weficD] [-b blocksize] [-d image_filename] [-s superblock] [-z undo_file] device"
+.BI open " [\-weficD] [\-b blocksize] [\-d image_filename] [\-s superblock] [\-z undo_file] device"
Open a file system for editing. The
-.I -f
+.I \-f
flag forces the file system to be opened even if there are some unknown
or incompatible file system features which would normally
prevent the file system from being opened. The
-.I -e
+.I \-e
flag causes the file system to be opened in exclusive mode. The
-.IR -b ", " -c ", " -d ", " -i ", " -s ", " -w ", and " -D
+.IR \-b ", " \-c ", " \-d ", " \-i ", " \-s ", " \-w ", and " \-D
options behave the same as the command-line options to
.BR debugfs .
.TP
.I pathname
to have no other references, deallocate the file. This command functions
as the unlink() system call.
-.I
.TP
.BI rmdir " filespec"
Remove the directory
.I filespec
as in use in the inode bitmap. If
.I num
-is specified, also set num-1 inodes after the specified inode.
+is specified, also set num\-1 inodes after the specified inode.
.TP
.BI set_inode_field " filespec field value"
Modify the inode specified by
so that the inode field
.I field
has value
-.I value.
+.IR value .
The list of valid inode fields which can be set via this command
can be displayed by using the command:
-.B set_inode_field -l
+.B set_inode_field \-l
Also available as
.BR sif .
.TP
Modify the multiple-mount protection (MMP) data so that the MMP field
.I field
has value
-.I value.
+.IR value .
The list of valid MMP fields which can be set via this command
can be displayed by using the command:
-.B set_mmp_value -l
+.B set_mmp_value \-l
Also available as
.BR smmp .
.TP
Set the superblock field
.I field
to
-.I value.
+.IR value .
The list of valid superblock fields which can be set via this command
can be displayed by using the command:
-.B set_super_value -l
+.B set_super_value \-l
Also available as
.BR ssv .
.TP
.B debugfs
parameters such as information about currently opened file system.
.TP
-.BI show_super_stats " [-h]"
+.BI show_super_stats " [\-h]"
List the contents of the super block and the block group descriptors. If the
-.I -h
+.I \-h
flag is given, only print out the superblock contents. Also available as
.BR stats .
.TP
into a newly-created file in the file system named
.IR out_file .
.TP
-.BI zap_block " [-f filespec] [-o offset] [-l length] [-p pattern] block_num"
+.BI zap_block " [\-f filespec] [\-o offset] [\-l length] [\-p pattern] block_num"
Overwrite the block specified by
.I block_num
with zero (NUL) bytes, or if
-.I -p
+.I \-p
is given use the byte specified by
.IR pattern .
If
-.I -f
+.I \-f
is given then
.I block_num
is relative to the start of the file given by
.IR filespec .
The
-.I -o
+.I \-o
and
-.I -l
+.I \-l
options limit the range of bytes to zap to the specified
.I offset
and
.I length
relative to the start of the block.
.TP
-.BI zap_block " [-f filespec] [-b bit] block_num"
+.BI zap_block " [\-f filespec] [\-b bit] block_num"
Bit-flip portions of the physical
.IR block_num .
If
-.I -f
+.I \-f
is given, then
.I block_num
is a logical block relative to the start of