{"id":3127,"date":"2022-12-20T16:43:33","date_gmt":"2022-12-20T19:43:33","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/debugfs-man8\/"},"modified":"2022-12-20T16:43:33","modified_gmt":"2022-12-20T19:43:33","slug":"debugfs-man8","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/debugfs-man8\/","title":{"rendered":"DEBUGFS (man8)"},"content":{"rendered":"<h1 align=\"center\">DEBUGFS<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#OPTIONS\">OPTIONS<\/a><br \/> <a href=\"#SPECIFYING FILES\">SPECIFYING FILES<\/a><br \/> <a href=\"#COMMANDS\">COMMANDS<\/a><br \/> <a href=\"#ENVIRONMENT VARIABLES\">ENVIRONMENT VARIABLES<\/a><br \/> <a href=\"#AUTHOR\">AUTHOR<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">debugfs \u2212 ext2\/ext3\/ext4 file system debugger<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>debugfs<\/b> [ <b>\u2212DVwcin<\/b> ] [ <b>\u2212b<\/b> blocksize ] [ <b>\u2212s<\/b> superblock ] [ <b>\u2212f<\/b> cmd_file ] [ <b>\u2212R<\/b> request ] [ <b>\u2212d<\/b> data_source_device ] [ <b>\u2212z<\/b> <i>undo_file<\/i> ] [ device ]<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">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>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>device<\/i> is a block device (e.g., \/dev\/sdXX) or a file containing the file system.<\/p>\n<h2>OPTIONS <a name=\"OPTIONS\"><\/a> <\/h2>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"3%\">\n<p style=\"margin-top: 1em\"><i>\u2212w<\/i><\/p>\n<\/td>\n<td width=\"8%\"><\/td>\n<td width=\"78%\">\n<p style=\"margin-top: 1em\">Specifies that the file system should be opened in read-write mode. Without this option, the file system is opened in read-only mode.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"3%\">\n<p><i>\u2212n<\/i><\/p>\n<\/td>\n<td width=\"8%\"><\/td>\n<td width=\"78%\">\n<p>Disables metadata checksum verification. This should only be used if you believe the metadata to be correct despite the complaints of e2fsprogs.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"3%\">\n<p><i>\u2212c<\/i><\/p>\n<\/td>\n<td width=\"8%\"><\/td>\n<td width=\"78%\">\n<p>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.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"3%\">\n<p><i>\u2212i<\/i><\/p>\n<\/td>\n<td width=\"8%\"><\/td>\n<td width=\"78%\">\n<p>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>\u2212d<\/i> option. <b>debugfs<\/b> is a debugging tool. It has rough edges!<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%;\"><i>-d data_source_device<\/i><\/p>\n<p style=\"margin-left:22%;\">Used with the <i>\u2212i<\/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.<\/p>\n<p style=\"margin-left:11%;\"><i>-b blocksize<\/i><\/p>\n<p style=\"margin-left:22%;\">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.)<\/p>\n<p style=\"margin-left:11%;\"><i>-s superblock<\/i><\/p>\n<p style=\"margin-left:22%;\">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.)<\/p>\n<p style=\"margin-left:11%;\"><i>-f cmd_file<\/i><\/p>\n<p style=\"margin-left:22%;\">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.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"3%\">\n<p><i>-D<\/i><\/p>\n<\/td>\n<td width=\"8%\"><\/td>\n<td width=\"78%\">\n<p>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.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%;\"><i>-R request<\/i><\/p>\n<p style=\"margin-left:22%;\">Causes <b>debugfs<\/b> to execute the single command <i>request<\/i>, and then exit.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"3%\">\n<p><i>-V<\/i><\/p>\n<\/td>\n<td width=\"8%\"><\/td>\n<td width=\"69%\">\n<p>print the version number of <b>debugfs<\/b> and exit.<\/p>\n<\/td>\n<td width=\"9%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%;\"><b>\u2212z<\/b> <i>undo_file<\/i><\/p>\n<p style=\"margin-left:22%;\">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 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>\n<p style=\"margin-left:22%; margin-top: 1em\">WARNING: The undo file cannot be used to recover from a power or system crash.<\/p>\n<h2>SPECIFYING FILES <a name=\"SPECIFYING FILES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">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 (\u2019\/\u2019), 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>.<\/p>\n<h2>COMMANDS <a name=\"COMMANDS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This is a list of the commands which <b>debugfs<\/b> supports. <b><br \/> blocks<\/b> <i>filespec<\/i><\/p>\n<p style=\"margin-left:22%;\">Print the blocks used by the inode <i>filespec<\/i> to stdout.<\/p>\n<p style=\"margin-left:11%;\"><b>bmap<\/b> <i>[ -a ] filespec logical_block [physical_block]<\/i><\/p>\n<p style=\"margin-left:22%;\">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>\u2212a<\/i> flag is specified, try to allocate a block if necessary.<\/p>\n<p style=\"margin-left:11%;\"><b>block_dump<\/b> <i>\u2019[ -x ] [-f filespec] block_num<\/i><\/p>\n<p style=\"margin-left:22%;\">Dump the filesystem block given by <i>block_num<\/i> in hex and ASCII format to the console. If the <i>\u2212f<\/i> option is specified, the block number is relative to the start of the given <b>filespec<\/b>. If the <i>\u2212x<\/i> option is specified, the block is interpreted as an extended attribute block and printed to show the structure of extended attribute data structures.<\/p>\n<p style=\"margin-left:11%;\"><b>cat<\/b> <i>filespec<\/i><\/p>\n<p style=\"margin-left:22%;\">Dump the contents of the inode <i>filespec<\/i> to stdout.<\/p>\n<p style=\"margin-left:11%;\"><b>cd<\/b> <i>filespec<\/i><\/p>\n<p style=\"margin-left:22%;\">Change the current working directory to <i>filespec<\/i>.<\/p>\n<p style=\"margin-left:11%;\"><b>chroot<\/b> <i>filespec<\/i><\/p>\n<p style=\"margin-left:22%;\">Change the root directory to be the directory <i>filespec<\/i>.<\/p>\n<p style=\"margin-left:11%;\"><b>close<\/b> <i>[-a]<\/i><\/p>\n<p style=\"margin-left:22%;\">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.<\/p>\n<p style=\"margin-left:11%;\"><b>clri<\/b> <i>filespec<\/i><\/p>\n<p style=\"margin-left:22%;\">Clear the contents of the inode <i>filespec<\/i>.<\/p>\n<p style=\"margin-left:11%;\"><b>copy_inode<\/b> <i>source_inode destination_inode<\/i><\/p>\n<p style=\"margin-left:22%;\">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>.<\/p>\n<p style=\"margin-left:11%;\"><b>dirsearch<\/b> <i>filespec filename<\/i><\/p>\n<p style=\"margin-left:22%;\">Search the directory <i>filespec<\/i> for <i>filename<\/i>.<\/p>\n<p style=\"margin-left:11%;\"><b>dirty<\/b> <i>[-clean]<\/i><\/p>\n<p style=\"margin-left:22%;\">Mark the filesystem as dirty, so that the superblocks will be written on exit. Additionally, clear the superblock\u2019s valid flag, or set it if <i>-clean<\/i> is specified.<\/p>\n<p style=\"margin-left:11%;\"><b>dump<\/b> <i>[-p] filespec out_file<\/i><\/p>\n<p style=\"margin-left:22%;\">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>.<\/p>\n<p style=\"margin-left:11%;\"><b>dump_mmp<\/b> <i>[mmp_block]<\/i><\/p>\n<p style=\"margin-left:22%;\">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.<\/p>\n<p style=\"margin-left:11%;\"><b>dx_hash<\/b> <i>[-h hash_alg] [-s hash_seed] filename<\/i><\/p>\n<p style=\"margin-left:22%;\">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.<\/p>\n<p style=\"margin-left:11%;\"><b>dump_extents<\/b> <i>[-n] [-l] filespec<\/i><\/p>\n<p style=\"margin-left:22%;\">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.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">(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.)<\/p>\n<p style=\"margin-left:11%;\"><b>dump_unused<\/b><\/p>\n<p style=\"margin-left:22%;\">Dump unused blocks which contain non-null bytes.<\/p>\n<p style=\"margin-left:11%;\"><b>ea_get<\/b> <i>[-f outfile]|[-xVC] [-r] filespec attr_name<\/i><\/p>\n<p style=\"margin-left:22%;\">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>.<\/p>\n<p style=\"margin-left:11%;\"><b>ea_list<\/b> <i>filespec<\/i><\/p>\n<p style=\"margin-left:22%;\">List the extended attributes associated with the file <i>filespec<\/i> to standard output.<\/p>\n<p style=\"margin-left:11%;\"><b>ea_set<\/b> <i>[-f infile] [-r] filespec attr_name attr_value<\/i><\/p>\n<p style=\"margin-left:22%;\">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>.<\/p>\n<p style=\"margin-left:11%;\"><b>ea_rm<\/b> <i>filespec attr_names&#8230;<\/i><\/p>\n<p style=\"margin-left:22%;\">Remove the extended attribute <i>attr_name<\/i> from the file <i>filespec<\/i>.<\/p>\n<p style=\"margin-left:11%;\"><b>expand_dir<\/b> <i>filespec<\/i><\/p>\n<p style=\"margin-left:22%;\">Expand the directory <i>filespec<\/i>.<\/p>\n<p style=\"margin-left:11%;\"><b>fallocate<\/b> <i>filespec start_block [end_block]<\/i><\/p>\n<p style=\"margin-left:22%;\">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.<\/p>\n<p style=\"margin-left:11%;\"><b>feature<\/b> <i>[fs_feature] [-fs_feature] &#8230;<\/i><\/p>\n<p style=\"margin-left:22%;\">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.<\/p>\n<p style=\"margin-left:11%;\"><b>filefrag<\/b> <i>[-dvr] filespec<\/i><\/p>\n<p style=\"margin-left:22%;\">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.<\/p>\n<p style=\"margin-left:11%;\"><b>find_free_block<\/b> <i>[count [goal]]<\/i><\/p>\n<p style=\"margin-left:22%;\">Find the first <i>count<\/i> free blocks, starting from <i>goal<\/i> and allocate it. Also available as <b>ffb<\/b>.<\/p>\n<p style=\"margin-left:11%;\"><b>find_free_inode<\/b> <i>[dir [mode]]<\/i><\/p>\n<p style=\"margin-left:22%;\">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>.<\/p>\n<p style=\"margin-left:11%;\"><b>freeb<\/b> <i>block [count]<\/i><\/p>\n<p style=\"margin-left:22%;\">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.<\/p>\n<p style=\"margin-left:11%;\"><b>freefrag<\/b> <i>[-c chunk_kb]<\/i><\/p>\n<p style=\"margin-left:22%;\">Report free space fragmentation on the currently open file system. If the <i>\u2212c<\/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.<\/p>\n<p style=\"margin-left:11%;\"><b>freei<\/b> <i>filespec [num]<\/i><\/p>\n<p style=\"margin-left:22%;\">Free the inode specified by <i>filespec<\/i>. If <i>num<\/i> is specified, also clear num-1 inodes after the specified inode.<\/p>\n<p style=\"margin-left:11%;\"><b>get_quota<\/b> <i>quota_type id<\/i><\/p>\n<p style=\"margin-left:22%;\">Display quota information for given quota type (user, group, or project) and ID.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"6%\">\n<p><b>help<\/b><\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"72%\">\n<p>Print a list of commands understood by <b>debugfs<\/b>.<\/p>\n<\/td>\n<td width=\"6%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%;\"><b>htree_dump<\/b> <i>filespec<\/i><\/p>\n<p style=\"margin-left:22%;\">Dump the hash-indexed directory <i>filespec<\/i>, showing its tree structure.<\/p>\n<p style=\"margin-left:11%;\"><b>icheck<\/b> <i>block &#8230;<\/i><\/p>\n<p style=\"margin-left:22%;\">Print a listing of the inodes which use the one or more blocks specified on the command line.<\/p>\n<p style=\"margin-left:11%;\"><b>inode_dump<\/b> <i>[-b]|[-e]|[-x] filespec<\/i><\/p>\n<p style=\"margin-left:22%;\">Print the contents of the inode data structure in hex and ASCII format. The <i>\u2212b<\/i> option causes the command to only dump the contents of the <b>i_blocks<\/b> array. The <i>\u2212e<\/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>\u2212x<\/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.<\/p>\n<p style=\"margin-left:11%;\"><b>imap<\/b> <i>filespec<\/i><\/p>\n<p style=\"margin-left:22%;\">Print the location of the inode data structure (in the inode table) of the inode <i>filespec<\/i>.<\/p>\n<p style=\"margin-left:11%;\"><b>init_filesys<\/b> <i>device blocksize<\/i><\/p>\n<p style=\"margin-left:22%;\">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>mke2fs<\/b>(8) program. This is just a call to the low-level library, which sets up the superblock and block descriptors.<\/p>\n<p style=\"margin-left:11%;\"><b>journal_close<\/b><\/p>\n<p style=\"margin-left:22%;\">Close the open journal.<\/p>\n<p style=\"margin-left:11%;\"><b>journal_open<\/b> <i>[-c] [-v ver] [-f ext_jnl]<\/i><\/p>\n<p style=\"margin-left:22%;\">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>.<\/p>\n<p style=\"margin-left:11%;\"><b>journal_run<\/b><\/p>\n<p style=\"margin-left:22%;\">Replay all transactions in the open journal.<\/p>\n<p style=\"margin-left:11%;\"><b>journal_write<\/b> <i>[-b blocks] [-r revoke] [-c] file<\/i><\/p>\n<p style=\"margin-left:22%;\">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.<\/p>\n<p style=\"margin-left:11%;\"><b>kill_file<\/b> <i>filespec<\/i><\/p>\n<p style=\"margin-left:22%;\">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>rm<\/b>(1) command if you wish to unlink a file.<\/p>\n<p style=\"margin-left:11%;\"><b>lcd<\/b> <i>directory<\/i><\/p>\n<p style=\"margin-left:22%;\">Change the current working directory of the <b>debugfs<\/b> process to <i>directory<\/i> on the native filesystem.<\/p>\n<p style=\"margin-left:11%;\"><b>list_quota<\/b> <i>quota_type<\/i><\/p>\n<p style=\"margin-left:22%;\">Display quota information for given quota type (user, group, or project).<\/p>\n<p style=\"margin-left:11%;\"><b>ln<\/b> <i>filespec dest_file<\/i><\/p>\n<p style=\"margin-left:22%;\">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.<\/p>\n<p style=\"margin-left:11%;\"><b>logdump<\/b> <i>[-acsOS] [-b block] [-i filespec] [-f journal_file] <br \/> [output_file]<\/i><\/p>\n<p style=\"margin-left:22%;\">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>\u2212i<\/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>\u2212f<\/i> option. Finally, the <i>\u2212s<\/i> option utilizes the backup information in the superblock to locate the journal.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">The <i>\u2212S<\/i> option causes <b>logdump<\/b> to print the contents of the journal superblock.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">The <i>\u2212a<\/i> option causes the <b>logdump<\/b> program to print the contents of all of the descriptor blocks. The <i>\u2212b<\/i> option causes <b>logdump<\/b> to print all journal records that refer to the specified block. The <i>\u2212c<\/i> option will print out the contents of all of the data blocks selected by the <i>\u2212a<\/i> and <i>\u2212b<\/i> options.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">The <i>\u2212O<\/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.<\/p>\n<p style=\"margin-left:11%;\"><b>ls<\/b> <i>[-l] [-c] [-d] [-p] [-r] filespec<\/i><\/p>\n<p style=\"margin-left:22%;\">Print a listing of the files in the directory <i>filespec<\/i>. The <i>\u2212c<\/i> flag causes directory block checksums (if present) to be displayed. The <i>\u2212d<\/i> flag will list deleted entries in the directory. The <i>\u2212l<\/i> flag will list files using a more verbose format. The <i>\u2212p<\/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>\u2212r<\/i> flag will force the printing of the filename, even if it is encrypted.<\/p>\n<p style=\"margin-left:11%;\"><b>list_deleted_inodes<\/b> <i>[limit]<\/i><\/p>\n<p style=\"margin-left:22%;\">List deleted inodes, optionally limited to those deleted within <i>limit<\/i> seconds ago. Also available as <b>lsdel<\/b>.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">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\u2019s data blocks are no longer available after the inode is released.<\/p>\n<p style=\"margin-left:11%;\"><b>modify_inode<\/b> <i>filespec<\/i><\/p>\n<p style=\"margin-left:22%;\">Modify the contents of the inode structure in the inode <i>filespec<\/i>. Also available as <b>mi<\/b>.<\/p>\n<p style=\"margin-left:11%;\"><b>mkdir<\/b> <i>filespec<\/i><\/p>\n<p style=\"margin-left:22%;\">Make a directory.<\/p>\n<p style=\"margin-left:11%;\"><b>mknod<\/b> <i>filespec [p|[[c|b] major minor]]<\/i><\/p>\n<p style=\"margin-left:22%;\">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.<\/p>\n<p style=\"margin-left:11%;\"><b>ncheck<\/b> <i>[-c] inode_num &#8230;<\/i><\/p>\n<p style=\"margin-left:22%;\">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\u2019s type.<\/p>\n<p style=\"margin-left:11%;\"><b>open<\/b> <i>[-weficD] [-b blocksize] [-d image_filename] [-s superblock] [-z <br \/> undo_file] device<\/i><\/p>\n<p style=\"margin-left:22%;\">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>.<\/p>\n<p style=\"margin-left:11%;\"><b>punch<\/b> <i>filespec start_blk [end_blk]<\/i><\/p>\n<p style=\"margin-left:22%;\">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.<\/p>\n<p style=\"margin-left:11%;\"><b>symlink<\/b> <i>filespec target<\/i><\/p>\n<p style=\"margin-left:22%;\">Make a symbolic link.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"6%\">\n<p><b>pwd<\/b><\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"55%\">\n<p>Print the current working directory.<\/p>\n<\/td>\n<td width=\"23%\"> <\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"6%\">\n<p><b>quit<\/b><\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"55%\">\n<p>Quit <b>debugfs<\/b><\/p>\n<\/td>\n<td width=\"23%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%;\"><b>rdump<\/b> <i>directory[&#8230;] destination<\/i><\/p>\n<p style=\"margin-left:22%;\">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.<\/p>\n<p style=\"margin-left:11%;\"><b>rm<\/b> <i>pathname<\/i><\/p>\n<p style=\"margin-left:22%;\">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.<\/p>\n<p style=\"margin-left:11%;\"><b>rmdir<\/b> <i>filespec<\/i><\/p>\n<p style=\"margin-left:22%;\">Remove the directory <i>filespec<\/i>.<\/p>\n<p style=\"margin-left:11%;\"><b>setb<\/b> <i>block [count]<\/i><\/p>\n<p style=\"margin-left:22%;\">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.<\/p>\n<p style=\"margin-left:11%;\"><b>set_block_group<\/b> <i>bgnum field value<\/i><\/p>\n<p style=\"margin-left:22%;\">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>.<\/p>\n<p style=\"margin-left:11%;\"><b>set_current_time<\/b> <i>time<\/i><\/p>\n<p style=\"margin-left:22%;\">Set current time in seconds since Unix epoch to use when setting filesystem fields.<\/p>\n<p style=\"margin-left:11%;\"><b>seti<\/b> <i>filespec [num]<\/i><\/p>\n<p style=\"margin-left:22%;\">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.<\/p>\n<p style=\"margin-left:11%;\"><b>set_inode_field<\/b> <i>filespec field value<\/i><\/p>\n<p style=\"margin-left:22%;\">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>.<\/p>\n<p style=\"margin-left:11%;\"><b>set_mmp_value<\/b> <i>field value<\/i><\/p>\n<p style=\"margin-left:22%;\">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>.<\/p>\n<p style=\"margin-left:11%;\"><b>set_super_value<\/b> <i>field value<\/i><\/p>\n<p style=\"margin-left:22%;\">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>.<\/p>\n<p style=\"margin-left:11%;\"><b>show_debugfs_params<\/b><\/p>\n<p style=\"margin-left:22%;\">Display <b>debugfs<\/b> parameters such as information about currently opened filesystem.<\/p>\n<p style=\"margin-left:11%;\"><b>show_super_stats<\/b> <i>[-h]<\/i><\/p>\n<p style=\"margin-left:22%;\">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>.<\/p>\n<p style=\"margin-left:11%;\"><b>stat<\/b> <i>filespec<\/i><\/p>\n<p style=\"margin-left:22%;\">Display the contents of the inode structure of the inode <i>filespec<\/i>.<\/p>\n<p style=\"margin-left:11%;\"><b>supported_features<\/b><\/p>\n<p style=\"margin-left:22%;\">Display filesystem features supported by this version of <b>debugfs<\/b>.<\/p>\n<p style=\"margin-left:11%;\"><b>testb<\/b> <i>block [count]<\/i><\/p>\n<p style=\"margin-left:22%;\">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.<\/p>\n<p style=\"margin-left:11%;\"><b>testi<\/b> <i>filespec<\/i><\/p>\n<p style=\"margin-left:22%;\">Test if the inode <i>filespec<\/i> is marked as allocated in the inode bitmap.<\/p>\n<p style=\"margin-left:11%;\"><b>undel<\/b> <i><inode_number> [pathname]<\/i><\/p>\n<p style=\"margin-left:22%;\">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.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">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.<\/p>\n<p style=\"margin-left:11%;\"><b>unlink<\/b> <i>pathname<\/i><\/p>\n<p style=\"margin-left:22%;\">Remove the link specified by <i>pathname<\/i> to an inode. Note this does not adjust the inode reference counts.<\/p>\n<p style=\"margin-left:11%;\"><b>write<\/b> <i>source_file out_file<\/i><\/p>\n<p style=\"margin-left:22%;\">Copy the contents of <i>source_file<\/i> into a newly-created file in the filesystem named <i>out_file<\/i>.<\/p>\n<p style=\"margin-left:11%;\"><b>zap_block<\/b> <i>[-f filespec] [-o offset] [-l length] [-p pattern] block_num<\/i><\/p>\n<p style=\"margin-left:22%;\">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.<\/p>\n<p style=\"margin-left:11%;\"><b>zap_block<\/b> <i>[-f filespec] [-b bit] block_num<\/i><\/p>\n<p style=\"margin-left:22%;\">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>.<\/p>\n<h2>ENVIRONMENT VARIABLES <a name=\"ENVIRONMENT VARIABLES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>DEBUGFS_PAGER, PAGER<\/b><\/p>\n<p style=\"margin-left:22%;\">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.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">Note that since a pager is always used, the <b>less<\/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>less<\/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.<\/p>\n<h2>AUTHOR <a name=\"AUTHOR\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>debugfs<\/b> was written by Theodore Ts\u2019o <tytso@mit.edu>.<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>dumpe2fs<\/b>(8), <b>tune2fs<\/b>(8), <b>e2fsck<\/b>(8), <b>mke2fs<\/b>(8), <b>ext4<\/b>(5)<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  debugfs \u2212 ext2\/ext3\/ext4 file system debugger <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[5,52,196,4],"class_list":["post-3127","post","type-post","status-publish","format-standard","hentry","category-8-administracion-del-sistema","tag-5","tag-administracion","tag-debugfs","tag-man8"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/3127","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=3127"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/3127\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=3127"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=3127"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=3127"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}