.\"
.TH DEBUGFS 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
.SH NAME
-debugfs \- ext2 file system debugger
+debugfs \- ext2/ext3 file system debugger
.SH SYNOPSIS
.B debugfs
[
+.B \-Vwci
+]
+[
.B \-b
blocksize
]
request
]
[
-.B \-V
-]
-[
-[
-.B \-w
-]
-[
-.B \-c
-]
-[
-.B \-i
+.B \-d
+data_source_device
]
[
device
]
-]
.SH DESCRIPTION
The
.B debugfs
.B debugfs
may fail in interesting ways if commands such as
.IR ls ", " dump ", "
-etc. are tried.
+etc. are tried without specifying the
+.I data_source_device
+using the
+.I \-d
+option.
.B debugfs
is a debugging tool. It has rough edges!
.TP
+.I -d data_source_device
+Used with the
+.I \-i
+option, specifies that
+.I data_source_device
+should be used when reading blocks not found in the ext2 image file.
+This includes data, directory, and indirect blocks.
+.TP
.I -b blocksize
Forces the use of the given block size for the file system, rather than
detecting the correct block size as normal.
of the inode
.IR filespec .
.TP
-.I initialize device blocksize
+.I init_filesys device blocksize
Create an ext2 file system on
.I device
with device size
.IR filespec .
Note this does not adjust the inode reference counts.
.TP
-.I logdump [-ac] [-b<block>] [-i<inode>] [-f<journal_file>] [output_file]
-Dump the contents of the ext3 journal.
+.I logdump [-acs] [-b<block>] [-i<filespec>] [-f<journal_file>] [output_file]
+Dump the contents of the ext3 journal. By default, the journal inode as
+specified in the superblock. However, this can be overridden with the
+.I \-i
+option, which uses an inode specifier to specify the journal to be
+used. A file containing journal data can be specified using the
+.I \-f
+option. Finally, the
+.I \-s
+option utilizes the backup information in the superblock to locate the
+journal.
+.IP
+The
+.I \-a
+option causes the
+.I logdump
+program to print the contents of all of the descriptor blocks.
+The
+.I \-b
+option causes
+.I logdump
+to print all journal records that are refer to the specified block.
+The
+.I \-c
+option will print out the contents of all of the data blocks selected by
+the
+.I \-a
+and
+.I \-b
+options.
.TP
.I ls [-l] [-d] filespec
Print a listing of the files in the directory
Take the requested list of inode numbers, and print a listing of pathnames
to those inodes.
.TP
-.I open [-w] [-f] [-i] [-c] [-b blocksize] [-s superblock] device
+.I open [-w] [-e] [-f] [-i] [-c] [-b blocksize] [-s superblock] device
Open a filesystem for editing. The
-.I -w
-flag causes the filesystem to be opened for writing. The
.I -f
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
-.IR -c ", " -b ", " -i ", " and " -s
-options behave the same as those to
-.B debugfs
-itself.
+.I -e
+flag causes the filesystem to be opened in exclusive mode. The
+.IR -b ", " -c ", " -i ", " -s ", and " -w
+options behave the same as the command-line options to
+.BR debugfs .
.TP
.I pwd
Print the current working directory.
.I block
will be marked as allocated.
.TP
+.I set_block_group bgnum field value
+Modify the block group descriptor specified by
+.I bgnum
+so that the block group descriptor field
+.I field
+has value
+.I value.
+.TP
.I seti filespec
Mark inode
.I filespec
as in use in the inode bitmap.
.TP
+.I set_inode_field filespec field value
+Modify the inode specified by
+.I filespec
+so that the inode field
+.I field
+has value
+.I 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
+.TP
.I set_super_value field value
Set the superblock field
.I field
.I filespec
is marked as allocated in the inode bitmap.
.TP
+.I undel <inode num> [pathname]
+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
+command should always be run after using the
+.B undel
+command to recover deleted files.
+.IP
+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
+command to link the inode to the destination pathname, or use
+.B e2fsck
+to check the filesystem and link all of the recovered inodes to the
+lost+found dirctory.
+.TP
.I unlink pathname
Remove the link specified by
.I pathname
and copy the contents of
.I source_file
into the destination file.
+.SH ENVIRONMENT VARIABLES
+.TP
+.B DEBUGFS_PAGER, PAGER
+The
+.BR debugfs (8)
+program always pipes the output of the some commands through a
+pager program. These commands include:
+.IR show_super_stats ,
+.IR list_directory ,
+.IR show_inode_info ,
+.IR list_deleted_inodes ,
+and
+.IR htree_dump .
+The specific pager can explicitly specified by the
+.B DEBUGFS_PAGER
+environment variable, and if it is not set, by the
+.B PAGER
+environment variable.
+.IP
+Note that since a pager is always used, the
+.BR less (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
+.BR less (1)
+pager for most purposes, which is why the
+.B DEBUGFS_PAGER
+environment variable is available to override the more general
+.B PAGER
+environment variable.
.SH AUTHOR
.B debugfs
was written by Theodore Ts'o <tytso@mit.edu>.
.SH SEE ALSO
.BR dumpe2fs (8),
+.BR tune2fs (8),
.BR e2fsck (8),
.BR mke2fs (8)