1248 lines
27 KiB
HTML
1248 lines
27 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of DEBUGFS</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>DEBUGFS</H1>
|
|
Section: Maintenance Commands (8)<BR>Updated: January 2020<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
debugfs - ext2/ext3/ext4 file system debugger
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>debugfs</B>
|
|
|
|
[
|
|
<B>-DVwcin</B>
|
|
|
|
]
|
|
[
|
|
<B>-b</B>
|
|
|
|
blocksize
|
|
]
|
|
[
|
|
<B>-s</B>
|
|
|
|
superblock
|
|
]
|
|
[
|
|
<B>-f</B>
|
|
|
|
cmd_file
|
|
]
|
|
[
|
|
<B>-R</B>
|
|
|
|
request
|
|
]
|
|
[
|
|
<B>-d</B>
|
|
|
|
data_source_device
|
|
]
|
|
[
|
|
<B>-z</B>
|
|
|
|
<I>undo_file</I>
|
|
|
|
]
|
|
[
|
|
device
|
|
]
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
The
|
|
<B>debugfs</B>
|
|
|
|
program is an interactive file system debugger. It can be used to
|
|
examine and change the state of an ext2, ext3, or ext4 file system.
|
|
<P>
|
|
|
|
<I>device</I>
|
|
|
|
is a block device (e.g., /dev/sdXX) or a file containing the file system.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="1"><I>-w</I>
|
|
|
|
<DD>
|
|
Specifies that the file system should be opened in read-write mode.
|
|
Without this option, the file system is opened in read-only mode.
|
|
<DT id="2"><I>-n</I>
|
|
|
|
<DD>
|
|
Disables metadata checksum verification. This should only be used if
|
|
you believe the metadata to be correct despite the complaints of
|
|
e2fsprogs.
|
|
<DT id="3"><I>-c</I>
|
|
|
|
<DD>
|
|
Specifies that the file system should be opened in catastrophic mode, in
|
|
which the inode and group bitmaps are not read initially. This can be
|
|
useful for filesystems with significant corruption, but because of this,
|
|
catastrophic mode forces the filesystem to be opened read-only.
|
|
<DT id="4"><I>-i</I>
|
|
|
|
<DD>
|
|
Specifies that
|
|
<I>device</I>
|
|
|
|
represents an ext2 image file created by the
|
|
<B>e2image</B>
|
|
|
|
program. Since the ext2 image file only contains the superblock, block
|
|
group descriptor, block and inode allocation bitmaps, and
|
|
the inode table, many
|
|
<B>debugfs</B>
|
|
|
|
commands will not function properly.
|
|
<B>Warning:</B>
|
|
|
|
no safety checks are in place, and
|
|
<B>debugfs</B>
|
|
|
|
may fail in interesting ways if commands such as
|
|
<I>ls</I>, <I>dump</I>,
|
|
|
|
etc. are tried without specifying the
|
|
<I>data_source_device</I>
|
|
|
|
using the
|
|
<I>-d</I>
|
|
|
|
option.
|
|
<B>debugfs</B>
|
|
|
|
is a debugging tool. It has rough edges!
|
|
<DT id="5"><I>-d data_source_device</I>
|
|
|
|
<DD>
|
|
Used with the
|
|
<I>-i</I>
|
|
|
|
option, specifies that
|
|
<I>data_source_device</I>
|
|
|
|
should be used when reading blocks not found in the ext2 image file.
|
|
This includes data, directory, and indirect blocks.
|
|
<DT id="6"><I>-b blocksize</I>
|
|
|
|
<DD>
|
|
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.)
|
|
<DT id="7"><I>-s superblock</I>
|
|
|
|
<DD>
|
|
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 filesystem). If you specify the
|
|
<I>-s</I>
|
|
|
|
option, you must also provide the blocksize of the filesystem via the
|
|
<I>-b</I>
|
|
|
|
option. (This
|
|
option is rarely needed; it is used primarily when the file system is
|
|
extremely badly damaged/corrupted.)
|
|
<DT id="8"><I>-f cmd_file</I>
|
|
|
|
<DD>
|
|
Causes
|
|
<B>debugfs</B>
|
|
|
|
to read in commands from
|
|
<I>cmd_file</I>,
|
|
|
|
and execute them. When
|
|
<B>debugfs</B>
|
|
|
|
is finished executing those commands, it will exit.
|
|
<DT id="9"><I>-D</I>
|
|
|
|
<DD>
|
|
Causes
|
|
<B>debugfs</B>
|
|
|
|
to open the device using Direct I/O, bypassing the buffer cache. Note
|
|
that some Linux devices, notably device mapper as of this writing, do
|
|
not support Direct I/O.
|
|
<DT id="10"><I>-R request</I>
|
|
|
|
<DD>
|
|
Causes
|
|
<B>debugfs</B>
|
|
|
|
to execute the single command
|
|
<I>request</I>,
|
|
|
|
and then exit.
|
|
<DT id="11"><I>-V</I>
|
|
|
|
<DD>
|
|
print the version number of
|
|
<B>debugfs</B>
|
|
|
|
and exit.
|
|
<DT id="12"><B>-z</B><I> undo_file</I>
|
|
|
|
<DD>
|
|
Before overwriting a file system block, write the old contents of the block to
|
|
an undo file. This undo file can be used with <A HREF="/cgi-bin/man/man2html?8+e2undo">e2undo</A>(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-<I>device</I>.e2undo in the directory specified via the
|
|
<I>E2FSPROGS_UNDO_DIR</I> environment variable.
|
|
<P>
|
|
WARNING: The undo file cannot be used to recover from a power or system crash.
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>SPECIFYING FILES</H2>
|
|
|
|
Many
|
|
<B>debugfs</B>
|
|
|
|
commands take a
|
|
<I>filespec</I>
|
|
|
|
as an argument to specify an inode (as opposed to a pathname)
|
|
in the filesystem which is currently opened by
|
|
<B>debugfs</B>.
|
|
|
|
The
|
|
<I>filespec</I>
|
|
|
|
argument may be specified in two forms. The first form is an inode
|
|
number surrounded by angle brackets, e.g.,
|
|
<I><2></I>.
|
|
|
|
The second form is a pathname; if the pathname is prefixed by a forward slash
|
|
('/'), then it is interpreted relative to the root of the filesystem
|
|
which is currently opened by
|
|
<B>debugfs</B>.
|
|
|
|
If not, the pathname is
|
|
interpreted relative to the current working directory as maintained by
|
|
<B>debugfs</B>.
|
|
|
|
This may be modified by using the
|
|
<B>debugfs</B>
|
|
|
|
command
|
|
<I>cd</I>.
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H2>COMMANDS</H2>
|
|
|
|
This is a list of the commands which
|
|
<B>debugfs</B>
|
|
|
|
supports.
|
|
<DL COMPACT>
|
|
<DT id="13"><B>blocks</B><I> filespec</I>
|
|
|
|
<DD>
|
|
Print the blocks used by the inode
|
|
<I>filespec</I>
|
|
|
|
to stdout.
|
|
<DT id="14"><B>bmap</B><I> [ -a ] filespec logical_block [physical_block]</I>
|
|
|
|
<DD>
|
|
Print or set the physical block number corresponding to the logical block number
|
|
<I>logical_block</I>
|
|
|
|
in the inode
|
|
<I>filespec</I>.
|
|
|
|
If the
|
|
<I>-a</I>
|
|
|
|
flag is specified, try to allocate a block if necessary.
|
|
<DT id="15"><B>block_dump</B><I> '[ -x ] [-f filespec] block_num</I>
|
|
|
|
<DD>
|
|
Dump the filesystem block given by
|
|
<I>block_num</I>
|
|
|
|
in hex and ASCII format to the console. If the
|
|
<I>-f</I>
|
|
|
|
option is specified, the block number is relative to the start of the given
|
|
<B>filespec</B>.
|
|
|
|
If the
|
|
<I>-x</I>
|
|
|
|
option is specified, the block is interpreted as an extended attribute
|
|
block and printed to show the structure of extended attribute data
|
|
structures.
|
|
<DT id="16"><B>cat</B><I> filespec</I>
|
|
|
|
<DD>
|
|
Dump the contents of the inode
|
|
<I>filespec</I>
|
|
|
|
to stdout.
|
|
<DT id="17"><B>cd</B><I> filespec</I>
|
|
|
|
<DD>
|
|
Change the current working directory to
|
|
<I>filespec</I>.
|
|
|
|
<DT id="18"><B>chroot</B><I> filespec</I>
|
|
|
|
<DD>
|
|
Change the root directory to be the directory
|
|
<I>filespec</I>.
|
|
|
|
<DT id="19"><B>close</B><I> [-a]</I>
|
|
|
|
<DD>
|
|
Close the currently open file system. If the
|
|
<I>-a</I>
|
|
|
|
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.
|
|
<DT id="20"><B>clri</B><I> filespec</I>
|
|
|
|
<DD>
|
|
Clear the contents of the inode
|
|
<I>filespec</I>.
|
|
|
|
<DT id="21"><B>copy_inode</B><I> source_inode destination_inode</I>
|
|
|
|
<DD>
|
|
Copy the contents of the inode structure in
|
|
<I>source_inode</I>
|
|
|
|
and use it to overwrite the inode structure at
|
|
<I>destination_inode</I>.
|
|
|
|
<DT id="22"><B>dirsearch</B><I> filespec filename</I>
|
|
|
|
<DD>
|
|
Search the directory
|
|
<I>filespec</I>
|
|
|
|
for
|
|
<I>filename</I>.
|
|
|
|
<DT id="23"><B>dirty</B><I> [-clean]</I>
|
|
|
|
<DD>
|
|
Mark the filesystem as dirty, so that the superblocks will be written on exit.
|
|
Additionally, clear the superblock's valid flag, or set it if
|
|
<I>-clean</I>
|
|
|
|
is specified.
|
|
<DT id="24"><B>dump</B><I> [-p] filespec out_file</I>
|
|
|
|
<DD>
|
|
Dump the contents of the inode
|
|
<I>filespec</I>
|
|
|
|
to the output file
|
|
<I>out_file</I>.
|
|
|
|
If the
|
|
<I>-p</I>
|
|
|
|
option is given set the owner, group and permissions information on
|
|
<I>out_file</I>
|
|
|
|
to match
|
|
<I>filespec</I>.
|
|
|
|
<DT id="25"><B>dump_mmp</B><I> [mmp_block]</I>
|
|
|
|
<DD>
|
|
Display the multiple-mount protection (mmp) field values. If
|
|
<I>mmp_block</I>
|
|
|
|
is specified then verify and dump the MMP values from the given block
|
|
number, otherwise use the
|
|
<B>s_mmp_block</B>
|
|
|
|
field in the superblock to locate and use the existing MMP block.
|
|
<DT id="26"><B>dx_hash</B><I> [-h hash_alg] [-s hash_seed] filename</I>
|
|
|
|
<DD>
|
|
Calculate the directory hash of
|
|
<I>filename</I>.
|
|
|
|
The hash algorithm specified with
|
|
<I>-h</I>
|
|
|
|
may be
|
|
<B>legacy</B>,<B> half_md4</B>, or <B>tea</B>.
|
|
|
|
The hash seed specified with
|
|
<I>-s</I>
|
|
|
|
must be in UUID format.
|
|
<DT id="27"><B>dump_extents</B><I> [-n] [-l] filespec</I>
|
|
|
|
<DD>
|
|
Dump the the extent tree of the inode
|
|
<I>filespec</I>.
|
|
|
|
The
|
|
<I>-n</I>
|
|
|
|
flag will cause
|
|
<B>dump_extents</B>
|
|
|
|
to only display the interior nodes in the extent tree. The
|
|
<I>-l</I>
|
|
|
|
flag will cause
|
|
<B>dump_extents</B>
|
|
|
|
to only display the leaf nodes in the extent tree.
|
|
<DT id="28"><DD>
|
|
(Please note that the length and range of blocks for the last extent in
|
|
an interior node is an estimate by the extents library functions, and is
|
|
not stored in filesystem data structures. Hence, the values displayed
|
|
may not necessarily by accurate and does not indicate a problem or
|
|
corruption in the file system.)
|
|
<DT id="29"><B>dump_unused</B>
|
|
|
|
<DD>
|
|
Dump unused blocks which contain non-null bytes.
|
|
<DT id="30"><B>ea_get</B><I> [-f outfile]|[-xVC] [-r] filespec attr_name</I>
|
|
|
|
<DD>
|
|
Retrieve the value of the extended attribute
|
|
<I>attr_name</I>
|
|
|
|
in the file
|
|
<I>filespec</I>
|
|
|
|
and write it either to stdout or to <I>outfile</I>.
|
|
<DT id="31"><B>ea_list</B><I> filespec</I>
|
|
|
|
<DD>
|
|
List the extended attributes associated with the file
|
|
<I>filespec</I>
|
|
|
|
to standard output.
|
|
<DT id="32"><B>ea_set</B><I> [-f infile] [-r] filespec attr_name attr_value</I>
|
|
|
|
<DD>
|
|
Set the value of the extended attribute
|
|
<I>attr_name</I>
|
|
|
|
in the file
|
|
<I>filespec</I>
|
|
|
|
to the string value
|
|
<I>attr_value</I>
|
|
|
|
or read it from <I>infile</I>.
|
|
<DT id="33"><B>ea_rm</B><I> filespec attr_names...</I>
|
|
|
|
<DD>
|
|
Remove the extended attribute
|
|
<I>attr_name</I>
|
|
|
|
from the file <I>filespec</I>.
|
|
<DT id="34"><B>expand_dir</B><I> filespec</I>
|
|
|
|
<DD>
|
|
Expand the directory
|
|
<I>filespec</I>.
|
|
|
|
<DT id="35"><B>fallocate</B><I> filespec start_block [end_block]</I>
|
|
|
|
<DD>
|
|
Allocate and map uninitialized blocks into <I>filespec</I> between
|
|
logical block <I>start_block</I> and <I>end_block</I>, inclusive. If
|
|
<I>end_block</I> 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.
|
|
<DT id="36"><B>feature</B><I> [fs_feature] [-fs_feature] ...</I>
|
|
|
|
<DD>
|
|
Set or clear various filesystem features in the superblock. After setting
|
|
or clearing any filesystem features that were requested, print the current
|
|
state of the filesystem feature set.
|
|
<DT id="37"><B>filefrag</B><I> [-dvr] filespec</I>
|
|
|
|
<DD>
|
|
Print the number of contiguous extents in
|
|
<I>filespec</I>.
|
|
|
|
If
|
|
<I>filespec</I>
|
|
|
|
is a directory and the
|
|
<I>-d</I>
|
|
|
|
option is not specified,
|
|
<I>filefrag</I>
|
|
|
|
will print the number of contiguous extents for each file in
|
|
the directory. The
|
|
<I>-v</I>
|
|
|
|
option will cause
|
|
<I>filefrag</I>
|
|
|
|
print a tabular listing of the contiguous extents in the
|
|
file. The
|
|
<I>-r</I>
|
|
|
|
option will cause
|
|
<I>filefrag</I>
|
|
|
|
to do a recursive listing of the directory.
|
|
<DT id="38"><B>find_free_block</B><I> [count [goal]]</I>
|
|
|
|
<DD>
|
|
Find the first
|
|
<I>count</I>
|
|
|
|
free blocks, starting from
|
|
<I>goal</I>
|
|
|
|
and allocate it. Also available as
|
|
<B>ffb</B>.
|
|
|
|
<DT id="39"><B>find_free_inode</B><I> [dir [mode]]</I>
|
|
|
|
<DD>
|
|
Find a free inode and allocate it. If present,
|
|
<I>dir</I>
|
|
|
|
specifies the inode number of the directory
|
|
which the inode is to be located. The second
|
|
optional argument
|
|
<I>mode</I>
|
|
|
|
specifies the permissions of the new inode. (If the directory bit is set
|
|
on the mode, the allocation routine will function differently.) Also
|
|
available as
|
|
<B>ffi</B>.
|
|
|
|
<DT id="40"><B>freeb</B><I> block [count]</I>
|
|
|
|
<DD>
|
|
Mark the block number
|
|
<I>block</I>
|
|
|
|
as not allocated.
|
|
If the optional argument
|
|
<I>count</I>
|
|
|
|
is present, then
|
|
<I>count</I>
|
|
|
|
blocks starting at block number
|
|
<I>block</I>
|
|
|
|
will be marked as not allocated.
|
|
<DT id="41"><B>freefrag</B><I> [-c chunk_kb]</I>
|
|
|
|
<DD>
|
|
Report free space fragmentation on the currently open file system.
|
|
If the
|
|
<I>-c</I>
|
|
|
|
option is specified then the filefrag command will print how many free
|
|
chunks of size
|
|
<I>chunk_kb</I>
|
|
|
|
can be found in the file system. The chunk size must be a power of two
|
|
and be larger than the file system block size.
|
|
<DT id="42"><B>freei</B><I> filespec [num]</I>
|
|
|
|
<DD>
|
|
Free the inode specified by
|
|
<I>filespec</I>.
|
|
|
|
If
|
|
<I>num</I>
|
|
|
|
is specified, also clear num-1 inodes after the specified inode.
|
|
<DT id="43"><B>get_quota</B><I> quota_type id</I>
|
|
|
|
<DD>
|
|
Display quota information for given quota type (user, group, or project) and ID.
|
|
<DT id="44"><B>help</B>
|
|
|
|
<DD>
|
|
Print a list of commands understood by
|
|
<B>debugfs</B>.
|
|
|
|
<DT id="45"><B>htree_dump</B><I> filespec</I>
|
|
|
|
<DD>
|
|
Dump the hash-indexed directory
|
|
<I>filespec</I>,
|
|
|
|
showing its tree structure.
|
|
<DT id="46"><B>icheck</B><I> block ...</I>
|
|
|
|
<DD>
|
|
Print a listing of the inodes which use the one or more blocks specified
|
|
on the command line.
|
|
<DT id="47"><B>inode_dump</B><I> [-b]|[-e]|[-x] filespec</I>
|
|
|
|
<DD>
|
|
Print the contents of the inode data structure in hex and ASCII format.
|
|
The
|
|
<I>-b</I>
|
|
|
|
option causes the command to only dump the contents of the
|
|
<B>i_blocks</B>
|
|
|
|
array. The
|
|
<I>-e</I>
|
|
|
|
option causes the command to only dump the contents of the extra inode
|
|
space, which is used to store in-line extended attributes. The
|
|
<I>-x</I>
|
|
|
|
option causes the command to dump the extra inode space interpreted and
|
|
extended attributes. This is useful to debug corrupted inodes
|
|
containing extended attributes.
|
|
<DT id="48"><B>imap</B><I> filespec</I>
|
|
|
|
<DD>
|
|
Print the location of the inode data structure (in the inode table)
|
|
of the inode
|
|
<I>filespec</I>.
|
|
|
|
<DT id="49"><B>init_filesys</B><I> device blocksize</I>
|
|
|
|
<DD>
|
|
Create an ext2 file system on
|
|
<I>device</I>
|
|
|
|
with device size
|
|
<I>blocksize</I>.
|
|
|
|
Note that this does not fully initialize all of the data structures;
|
|
to do this, use the
|
|
<B><A HREF="/cgi-bin/man/man2html?8+mke2fs">mke2fs</A></B>(8)
|
|
|
|
program. This is just a call to the low-level library, which sets up
|
|
the superblock and block descriptors.
|
|
<DT id="50"><B>journal_close</B>
|
|
|
|
<DD>
|
|
Close the open journal.
|
|
<DT id="51"><B>journal_open</B><I> [-c] [-v ver] [-f ext_jnl]</I>
|
|
|
|
<DD>
|
|
Opens the journal for reading and writing. Journal checksumming can
|
|
be enabled by supplying <I>-c</I>; checksum formats 2 and 3 can be
|
|
selected with the <I>-v</I> option. An external journal can be loaded
|
|
from <I>ext_jnl</I>.
|
|
<DT id="52"><B>journal_run</B>
|
|
|
|
<DD>
|
|
Replay all transactions in the open journal.
|
|
<DT id="53"><B>journal_write</B><I> [-b blocks] [-r revoke] [-c] file</I>
|
|
|
|
<DD>
|
|
Write a transaction to the open journal. The list of blocks to write
|
|
should be supplied as a comma-separated list in <I>blocks</I>; the
|
|
blocks themselves should be readable from <I>file</I>. A list of
|
|
blocks to revoke can be supplied as a comma-separated list in
|
|
<I>revoke</I>. By default, a commit record is written at the end; the
|
|
<I>-c</I> switch writes an uncommitted transaction.
|
|
<DT id="54"><B>kill_file</B><I> filespec</I>
|
|
|
|
<DD>
|
|
Deallocate the inode
|
|
<I>filespec</I>
|
|
|
|
and its blocks. Note that this does not remove any directory
|
|
entries (if any) to this inode. See the
|
|
<B><A HREF="/cgi-bin/man/man2html?1+rm">rm</A></B>(1)
|
|
|
|
command if you wish to unlink a file.
|
|
<DT id="55"><B>lcd</B><I> directory</I>
|
|
|
|
<DD>
|
|
Change the current working directory of the
|
|
<B>debugfs</B>
|
|
|
|
process to
|
|
<I>directory</I>
|
|
|
|
on the native filesystem.
|
|
<DT id="56"><B>list_quota</B><I> quota_type</I>
|
|
|
|
<DD>
|
|
Display quota information for given quota type (user, group, or project).
|
|
<DT id="57"><B>ln</B><I> filespec dest_file</I>
|
|
|
|
<DD>
|
|
Create a link named
|
|
<I>dest_file</I>
|
|
|
|
which is a hard link to
|
|
<I>filespec</I>.
|
|
|
|
Note this does not adjust the inode reference counts.
|
|
<DT id="58"><B>logdump</B><I> [-acsOS] [-b block] [-i filespec] [-f journal_file] [output_file]</I>
|
|
|
|
<DD>
|
|
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>
|
|
|
|
option, which dumps the journal from the internal inode given by
|
|
<I>filespec</I>.
|
|
|
|
A regular file containing journal data can be specified using the
|
|
<I>-f</I>
|
|
|
|
option. Finally, the
|
|
<I>-s</I>
|
|
|
|
option utilizes the backup information in the superblock to locate the
|
|
journal.
|
|
<DT id="59"><DD>
|
|
The
|
|
<I>-S</I>
|
|
|
|
option causes
|
|
<B>logdump</B>
|
|
|
|
to print the contents of the journal superblock.
|
|
<DT id="60"><DD>
|
|
The
|
|
<I>-a</I>
|
|
|
|
option causes the
|
|
<B>logdump</B>
|
|
|
|
program to print the contents of all of the descriptor blocks.
|
|
The
|
|
<I>-b</I>
|
|
|
|
option causes
|
|
<B>logdump</B>
|
|
|
|
to print all journal records that refer to the specified block.
|
|
The
|
|
<I>-c</I>
|
|
|
|
option will print out the contents of all of the data blocks selected by
|
|
the
|
|
<I>-a</I>
|
|
|
|
and
|
|
<I>-b</I>
|
|
|
|
options.
|
|
<DT id="61"><DD>
|
|
The
|
|
<I>-O</I>
|
|
|
|
option causes logdump to display old (checkpointed) journal entries.
|
|
This can be used to try to track down journal problems even after the
|
|
journal has been replayed.
|
|
<DT id="62"><B>ls</B><I> [-l] [-c] [-d] [-p] [-r] filespec</I>
|
|
|
|
<DD>
|
|
Print a listing of the files in the directory
|
|
<I>filespec</I>.
|
|
|
|
The
|
|
<I>-c</I>
|
|
|
|
flag causes directory block checksums (if present) to be displayed.
|
|
The
|
|
<I>-d</I>
|
|
|
|
flag will list deleted entries in the directory.
|
|
The
|
|
<I>-l</I>
|
|
|
|
flag will list files using a more verbose format.
|
|
The
|
|
<I>-p</I>
|
|
|
|
flag will list the files in a format which is more easily parsable by
|
|
scripts, as well as making it more clear when there are spaces or other
|
|
non-printing characters at the end of filenames.
|
|
The
|
|
<I>-r</I>
|
|
|
|
flag will force the printing of the filename, even if it is encrypted.
|
|
<DT id="63"><B>list_deleted_inodes</B><I> [limit]</I>
|
|
|
|
<DD>
|
|
List deleted inodes, optionally limited to those deleted within
|
|
<I>limit</I>
|
|
|
|
seconds ago. Also available as
|
|
<B>lsdel</B>.
|
|
|
|
<DT id="64"><DD>
|
|
This command was useful for recovering from accidental file deletions
|
|
for ext2 file systems. Unfortunately, it is not useful for this purpose
|
|
if the files were deleted using ext3 or ext4, since the inode's
|
|
data blocks are no longer available after the inode is released.
|
|
<DT id="65"><B>modify_inode</B><I> filespec</I>
|
|
|
|
<DD>
|
|
Modify the contents of the inode structure in the inode
|
|
<I>filespec</I>.
|
|
|
|
Also available as
|
|
<B>mi</B>.
|
|
|
|
<DT id="66"><B>mkdir</B><I> filespec</I>
|
|
|
|
<DD>
|
|
Make a directory.
|
|
<DT id="67"><B>mknod</B><I> filespec [p|[[c|b] major minor]]</I>
|
|
|
|
<DD>
|
|
Create a special device file (a named pipe, character or block device).
|
|
If a character or block device is to be made, the
|
|
<I>major</I>
|
|
|
|
and
|
|
<I>minor</I>
|
|
|
|
device numbers must be specified.
|
|
<DT id="68"><B>ncheck</B><I> [-c] inode_num ...</I>
|
|
|
|
<DD>
|
|
Take the requested list of inode numbers, and print a listing of pathnames
|
|
to those inodes. The
|
|
<I>-c</I>
|
|
|
|
flag will enable checking the file type information in the directory
|
|
entry to make sure it matches the inode's type.
|
|
<DT id="69"><B>open</B><I> [-weficD] [-b blocksize] [-d image_filename] [-s superblock] [-z undo_file] device</I>
|
|
|
|
<DD>
|
|
Open a filesystem for editing. The
|
|
<I>-f</I>
|
|
|
|
flag forces the filesystem to be opened even if there are some unknown
|
|
or incompatible filesystem features which would normally
|
|
prevent the filesystem from being opened. The
|
|
<I>-e</I>
|
|
|
|
flag causes the filesystem to be opened in exclusive mode. The
|
|
<I>-b</I>, <I>-c</I>, <I>-d</I>, <I>-i</I>, <I>-s</I>, <I>-w</I>, and <I>-D</I>
|
|
|
|
options behave the same as the command-line options to
|
|
<B>debugfs</B>.
|
|
|
|
<DT id="70"><B>punch</B><I> filespec start_blk [end_blk]</I>
|
|
|
|
<DD>
|
|
Delete the blocks in the inode ranging from
|
|
<I>start_blk</I>
|
|
|
|
to
|
|
<I>end_blk</I>.
|
|
|
|
If
|
|
<I>end_blk</I>
|
|
|
|
is omitted then this command will function as a truncate command; that
|
|
is, all of the blocks starting at
|
|
<I>start_blk</I>
|
|
|
|
through to the end of the file will be deallocated.
|
|
<DT id="71"><B>symlink</B><I> filespec target</I>
|
|
|
|
<DD>
|
|
Make a symbolic link.
|
|
<DT id="72"><B>pwd</B>
|
|
|
|
<DD>
|
|
Print the current working directory.
|
|
<DT id="73"><B>quit</B>
|
|
|
|
<DD>
|
|
Quit
|
|
<B>debugfs</B>
|
|
|
|
<DT id="74"><B>rdump</B><I> directory[...] destination</I>
|
|
|
|
<DD>
|
|
Recursively dump
|
|
<I>directory</I>,
|
|
|
|
or multiple
|
|
<I>directories</I>,
|
|
|
|
and all its contents (including regular files, symbolic links, and other
|
|
directories) into the named
|
|
<I>destination</I>,
|
|
|
|
which should be an existing directory on the native filesystem.
|
|
<DT id="75"><B>rm</B><I> pathname</I>
|
|
|
|
<DD>
|
|
Unlink
|
|
<I>pathname</I>.
|
|
|
|
If this causes the inode pointed to by
|
|
<I>pathname</I>
|
|
|
|
to have no other references, deallocate the file. This command functions
|
|
as the unlink() system call.
|
|
<I><DT id="76"></I><B>rmdir</B><I> filespec</I>
|
|
|
|
<DD>
|
|
|
|
|
|
Remove the directory
|
|
<I>filespec</I>.
|
|
|
|
<DT id="77"><B>setb</B><I> block [count]</I>
|
|
|
|
<DD>
|
|
Mark the block number
|
|
<I>block</I>
|
|
|
|
as allocated.
|
|
If the optional argument
|
|
<I>count</I>
|
|
|
|
is present, then
|
|
<I>count</I>
|
|
|
|
blocks starting at block number
|
|
<I>block</I>
|
|
|
|
will be marked as allocated.
|
|
<DT id="78"><B>set_block_group</B><I> bgnum field value</I>
|
|
|
|
<DD>
|
|
Modify the block group descriptor specified by
|
|
<I>bgnum</I>
|
|
|
|
so that the block group descriptor field
|
|
<I>field</I>
|
|
|
|
has value
|
|
<I>value</I>.
|
|
|
|
Also available as
|
|
<B>set_bg</B>.
|
|
|
|
<DT id="79"><B>set_current_time</B><I> time</I>
|
|
|
|
<DD>
|
|
Set current time in seconds since Unix epoch to use when setting filesystem
|
|
fields.
|
|
<DT id="80"><B>seti</B><I> filespec [num]</I>
|
|
|
|
<DD>
|
|
Mark inode
|
|
<I>filespec</I>
|
|
|
|
as in use in the inode bitmap. If
|
|
<I>num</I>
|
|
|
|
is specified, also set num-1 inodes after the specified inode.
|
|
<DT id="81"><B>set_inode_field</B><I> filespec field value</I>
|
|
|
|
<DD>
|
|
Modify the inode specified by
|
|
<I>filespec</I>
|
|
|
|
so that the inode field
|
|
<I>field</I>
|
|
|
|
has value
|
|
<I>value.</I>
|
|
|
|
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>
|
|
|
|
Also available as
|
|
<B>sif</B>.
|
|
|
|
<DT id="82"><B>set_mmp_value</B><I> field value</I>
|
|
|
|
<DD>
|
|
Modify the multiple-mount protection (MMP) data so that the MMP field
|
|
<I>field</I>
|
|
|
|
has value
|
|
<I>value.</I>
|
|
|
|
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>
|
|
|
|
Also available as
|
|
<B>smmp</B>.
|
|
|
|
<DT id="83"><B>set_super_value</B><I> field value</I>
|
|
|
|
<DD>
|
|
Set the superblock field
|
|
<I>field</I>
|
|
|
|
to
|
|
<I>value.</I>
|
|
|
|
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>
|
|
|
|
Also available as
|
|
<B>ssv</B>.
|
|
|
|
<DT id="84"><B>show_debugfs_params</B>
|
|
|
|
<DD>
|
|
Display
|
|
<B>debugfs</B>
|
|
|
|
parameters such as information about currently opened filesystem.
|
|
<DT id="85"><B>show_super_stats</B><I> [-h]</I>
|
|
|
|
<DD>
|
|
List the contents of the super block and the block group descriptors. If the
|
|
<I>-h</I>
|
|
|
|
flag is given, only print out the superblock contents. Also available as
|
|
<B>stats</B>.
|
|
|
|
<DT id="86"><B>stat</B><I> filespec</I>
|
|
|
|
<DD>
|
|
Display the contents of the inode structure of the inode
|
|
<I>filespec</I>.
|
|
|
|
<DT id="87"><B>supported_features</B>
|
|
|
|
<DD>
|
|
Display filesystem features supported by this version of
|
|
<B>debugfs</B>.
|
|
|
|
<DT id="88"><B>testb</B><I> block [count]</I>
|
|
|
|
<DD>
|
|
Test if the block number
|
|
<I>block</I>
|
|
|
|
is marked as allocated in the block bitmap.
|
|
If the optional argument
|
|
<I>count</I>
|
|
|
|
is present, then
|
|
<I>count</I>
|
|
|
|
blocks starting at block number
|
|
<I>block</I>
|
|
|
|
will be tested.
|
|
<DT id="89"><B>testi</B><I> filespec</I>
|
|
|
|
<DD>
|
|
Test if the inode
|
|
<I>filespec</I>
|
|
|
|
is marked as allocated in the inode bitmap.
|
|
<DT id="90"><B>undel</B><I> <inode_number> [pathname]</I>
|
|
|
|
<DD>
|
|
Undelete the specified inode number (which must be surrounded by angle
|
|
brackets) so that it and its blocks are marked in use, and optionally
|
|
link the recovered inode to the specified pathname. The
|
|
<B>e2fsck</B>
|
|
|
|
command should always be run after using the
|
|
<B>undel</B>
|
|
|
|
command to recover deleted files.
|
|
<DT id="91"><DD>
|
|
Note that if you are recovering a large number of deleted files, linking
|
|
the inode to a directory may require the directory to be expanded, which
|
|
could allocate a block that had been used by one of the
|
|
yet-to-be-undeleted files. So it is safer to undelete all of the
|
|
inodes without specifying a destination pathname, and then in a separate
|
|
pass, use the debugfs
|
|
<B>link</B>
|
|
|
|
command to link the inode to the destination pathname, or use
|
|
<B>e2fsck</B>
|
|
|
|
to check the filesystem and link all of the recovered inodes to the
|
|
lost+found directory.
|
|
<DT id="92"><B>unlink</B><I> pathname</I>
|
|
|
|
<DD>
|
|
Remove the link specified by
|
|
<I>pathname</I>
|
|
|
|
to an inode. Note this does not adjust the inode reference counts.
|
|
<DT id="93"><B>write</B><I> source_file out_file</I>
|
|
|
|
<DD>
|
|
Copy the contents of
|
|
<I>source_file</I>
|
|
|
|
into a newly-created file in the filesystem named
|
|
<I>out_file</I>.
|
|
|
|
<DT id="94"><B>zap_block</B><I> [-f filespec] [-o offset] [-l length] [-p pattern] block_num</I>
|
|
|
|
<DD>
|
|
Overwrite the block specified by
|
|
<I>block_num</I>
|
|
|
|
with zero (NUL) bytes, or if
|
|
<I>-p</I>
|
|
|
|
is given use the byte specified by
|
|
<I>pattern</I>.
|
|
|
|
If
|
|
<I>-f</I>
|
|
|
|
is given then
|
|
<I>block_num</I>
|
|
|
|
is relative to the start of the file given by
|
|
<I>filespec</I>.
|
|
|
|
The
|
|
<I>-o</I>
|
|
|
|
and
|
|
<I>-l</I>
|
|
|
|
options limit the range of bytes to zap to the specified
|
|
<I>offset</I>
|
|
|
|
and
|
|
<I>length</I>
|
|
|
|
relative to the start of the block.
|
|
<DT id="95"><B>zap_block</B><I> [-f filespec] [-b bit] block_num</I>
|
|
|
|
<DD>
|
|
Bit-flip portions of the physical
|
|
<I>block_num</I>.
|
|
|
|
If
|
|
<I>-f</I>
|
|
|
|
is given, then
|
|
<I>block_num</I>
|
|
|
|
is a logical block relative to the start of
|
|
<I>filespec</I>.
|
|
|
|
</DL>
|
|
<A NAME="lbAH"> </A>
|
|
<H2>ENVIRONMENT VARIABLES</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="96"><B>DEBUGFS_PAGER, PAGER</B>
|
|
|
|
<DD>
|
|
The
|
|
<B>debugfs</B>
|
|
|
|
program always pipes the output of the some commands through a
|
|
pager program. These commands include:
|
|
<I>show_super_stats</I> (<I>stats</I>),
|
|
|
|
<I>list_directory</I> (<I>ls</I>),
|
|
|
|
<I>show_inode_info</I> (<I>stat</I>),
|
|
|
|
<I>list_deleted_inodes</I> (<I>lsdel</I>),
|
|
|
|
and
|
|
<I>htree_dump</I>.
|
|
|
|
The specific pager can explicitly specified by the
|
|
<B>DEBUGFS_PAGER</B>
|
|
|
|
environment variable, and if it is not set, by the
|
|
<B>PAGER</B>
|
|
|
|
environment variable.
|
|
<DT id="97"><DD>
|
|
Note that since a pager is always used, the
|
|
<B><A HREF="/cgi-bin/man/man2html?1+less">less</A></B>(1)
|
|
|
|
pager is not particularly appropriate, since it clears the screen before
|
|
displaying the output of the command and clears the output the screen
|
|
when the pager is exited. Many users prefer to use the
|
|
<B><A HREF="/cgi-bin/man/man2html?1+less">less</A></B>(1)
|
|
|
|
pager for most purposes, which is why the
|
|
<B>DEBUGFS_PAGER</B>
|
|
|
|
environment variable is available to override the more general
|
|
<B>PAGER</B>
|
|
|
|
environment variable.
|
|
</DL>
|
|
<A NAME="lbAI"> </A>
|
|
<H2>AUTHOR</H2>
|
|
|
|
<B>debugfs</B>
|
|
|
|
was written by Theodore Ts'o <<A HREF="mailto:tytso@mit.edu">tytso@mit.edu</A>>.
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+dumpe2fs">dumpe2fs</A></B>(8),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+tune2fs">tune2fs</A></B>(8),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+e2fsck">e2fsck</A></B>(8),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+mke2fs">mke2fs</A></B>(8),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?5+ext4">ext4</A></B>(5)
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="98"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="99"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="100"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="101"><A HREF="#lbAE">OPTIONS</A><DD>
|
|
<DT id="102"><A HREF="#lbAF">SPECIFYING FILES</A><DD>
|
|
<DT id="103"><A HREF="#lbAG">COMMANDS</A><DD>
|
|
<DT id="104"><A HREF="#lbAH">ENVIRONMENT VARIABLES</A><DD>
|
|
<DT id="105"><A HREF="#lbAI">AUTHOR</A><DD>
|
|
<DT id="106"><A HREF="#lbAJ">SEE ALSO</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:06:11 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|