LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

debugfs

interactive debugger for ext2/ext3/ext4 filesystems

TLDR

Open filesystem in read-only mode
$ debugfs [/dev/sdXN]
copy
Open filesystem in read-write mode
$ debugfs -w [/dev/sdXN]
copy
Read commands from file
$ debugfs -f [path/to/cmd_file] [/dev/sdXN]
copy
Execute a single command and exit
$ debugfs -R "stats" [/dev/sdXN]
copy
List deleted inodes (interactive)
$ lsdel
copy
Recover a deleted inode to a file (interactive)
$ dump <[inode_number]> [/path/to/output]
copy

SYNOPSIS

debugfs [options] [device]

DESCRIPTION

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.

PARAMETERS

-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 cmdfile_
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 undofile_
Write old block contents to an undo file before overwriting (for use with e2undo)

INTERACTIVE COMMANDS

stats

Show filesystem statistics
ls dir
List directory contents
cat file
Display file contents
lsdel
List deleted inodes
undel <inode> [pathname]
Undelete inode and optionally link to pathname
dump inode file
Dump inode contents to a file
ncheck inode
Translate inode numbers to pathnames
icheck block
Translate block numbers to inodes
logdump
Dump ext3/ext4 journal contents

INSTALL

sudo apt install e2fsprogs
copy
sudo dnf install e2fsprogs
copy
sudo pacman -S e2fsprogs
copy
sudo apk add e2fsprogs-extra
copy
sudo zypper install e2fsprogs
copy
brew install e2fsprogs
copy
nix profile install nixpkgs#e2fsprogs
copy

CAVEATS

Requires root privileges. Use with extreme caution in write mode. Unmount filesystem before making changes. Improper use can cause data loss.

SEE ALSO

e2fsck(8), dumpe2fs(8), tune2fs(8)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid