jfs_debugfs
Debug and examine JFS filesystem structures
SYNOPSIS
jfs_debugfs [-b blocksize] [-c] [-D] [-f cmds_file] [-n] [-q] [-V] [-x] device
PARAMETERS
-b blocksize
Specify JFS block size in bytes (default auto-detect)
-c
Output in C-language source format
-D
Enable destructive write access (use with extreme caution!)
-f cmds_file
Execute commands from specified batch file
-n
Suppress heading banners
-q
Quiet mode; suppress non-error output
-V
Print version information and exit
-x
Enable expert mode with additional commands
DESCRIPTION
jfs_debugfs is a powerful user-space utility for examining and modifying JFS (Journaled File System) structures on Linux. Similar to debugfs for ext2/3/4 or xfs_db for XFS, it provides an interactive command-line interface to inspect superblocks, inodes, directories, extents, and other metadata.
Designed for filesystem developers, recovery experts, and advanced admins, it allows reading filesystem details non-destructively or writing changes with the risky -D option. Common uses include diagnosing corruption, extracting lost data, tuning parameters, or scripting repairs.
The tool opens the specified block device (e.g., /dev/sda1) and enters an interactive shell with commands like ls, cd, pwd, stat, imap, logdump, and fragdump for dumping fragmentation info. Batch mode via -f enables automation. Output can be formatted as C source code with -c.
Requires root privileges and JFS-utils package. Always unmount the filesystem first to avoid inconsistencies.
CAVEATS
Extremely dangerous for writes (-D); can corrupt data irreversibly. Requires root and unmounted device. Not for production use without backups. Block device only; no images.
INTERACTIVE COMMANDS
Key commands: ls (list dir), cd/pwd (navigate), stat (inode info), imap (indirect blocks), logdump (log analysis), fragdump (fragmentation), help (list all). Use quit to exit.
EXAMPLE USAGE
jfs_debugfs /dev/sdb1 (interactive read-only)
echo 'ls /lost+found' | jfs_debugfs -q -f - /dev/sdb1 (batch ls)
jfs_debugfs -D -f fix.cmd /dev/sdb1 (dangerous scripted fix)
HISTORY
Developed by IBM as part of JFS port to Linux (kernel 2.4.18+, 2001-2002). Maintained in jfsutils package; enhancements for Linux 2.6+ compatibility and new commands added over time.
SEE ALSO
jfs_fsck(8), jfs_tune(8), jfs_logdump(8), debugfs(8), xfs_db(8)


