Linux command
debugfs 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Example
debugfs [/dev/sdXN]
Example
debugfs -w [/dev/sdXN]
Example
debugfs -f [path/to/cmd_file] [/dev/sdXN]
Example
debugfs -R "stats" [/dev/sdXN]
List deleted
lsdel
Recover
dump <[inode_number]> [/path/to/output]
说明
debugfs is an interactive debugger for ext2/ext3/ext4 filesystems. It allows direct manipulation of filesystem structures, which is useful for data recovery, analysis, and troubleshooting. Can be used to recover deleted files, examine inodes, and manually fix filesystem issues.
参数
- -w
- Open in read-write mode (default is read-only)
- -c
- Open in catastrophic mode (inode and group bitmaps not read initially, forces read-only)
- -n
- Disable metadata checksum verification
- -f _cmd_file_
- Read and execute commands from file, then exit
- -R _request_
- Execute a single command and exit
- -b _blocksize_
- Force a specific block size in bytes instead of auto-detecting
- -s _superblock_
- Read superblock from the given block number (requires -b)
- -i
- Treat device as an ext2 image file created by e2image
- -D
- Open device using Direct I/O, bypassing the buffer cache
- -z _undo_file_
- Write old block contents to an undo file before overwriting (for use with e2undo)
FAQ
What is the debugfs command used for?
debugfs is an interactive debugger for ext2/ext3/ext4 filesystems. It allows direct manipulation of filesystem structures, which is useful for data recovery, analysis, and troubleshooting. Can be used to recover deleted files, examine inodes, and manually fix filesystem issues.
How do I run a basic debugfs example?
Run `debugfs [/dev/sdXN]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -w do in debugfs?
Open in read-write mode (default is read-only)