btrfs-inspect-internal
Inspect internal Btrfs filesystem data structures
TLDR
Print superblock's information
Print superblock's and all of its copies' information
Print filesystem's metadata information
Print list of files in inode n-th
Print list of files at a given logical address
Print stats of root, extent, csum, and fs trees
SYNOPSIS
btrfs inspect-internal [-fsv] <subcommand> [<args>]
PARAMETERS
-f, --force
Allow potentially dangerous operations (rarely needed for inspection)
-s, --raw
Print raw hex dump of structures instead of decoded output
-v, --verbose
Increase verbosity of output
DESCRIPTION
btrfs inspect-internal is a specialized tool from the btrfs-progs package designed for developers and advanced users to examine the internal metadata structures of BTRFS filesystems without mounting them. It provides low-level access to superblocks, extent trees, inode records, and other on-disk data, making it invaluable for debugging filesystem corruption, analyzing layout issues, or understanding BTRFS internals.
The command supports several subcommands, such as dumping superblock contents to verify filesystem parameters like UUIDs, block sizes, and generation numbers; dumping tree structures to visualize metadata trees by object ID or block address; resolving logical byte addresses to physical extents; and listing references for roots or inodes. Output can be raw hex dumps for scripting or verbose human-readable formats.
Primarily read-only, it helps in forensics on damaged devices but requires root privileges and device paths. It's not intended for routine administration—use btrfs subcommands like filesystem show or device stats instead. Incorrect interpretation of dumps can mislead repairs, so familiarity with BTRFS on-disk format is essential.
CAVEATS
Intended for experts only; requires raw device access and superuser privileges. Misuse or misinterpretation may lead to incorrect filesystem repairs. Not safe on mounted filesystems.
SUBCOMMANDS
dump-super [-s <num>] <device>: Dump superblock(s).
dump-tree [-t <objid>] [-b <block>] [-r] [-u] [-x] <device>: Dump tree or metadata block.
logical-resolve [-p|-e] <logical> <device>[:<path>]: Resolve logical to physical.
min-max <device>: Show min/max extent ranges.
root-ref <device> <root> <path>: List root references.
inode-ref <device> <ino> <gen>: List inode references.
DUMP-TREE OPTIONS
-t <objid>: Specify tree by object ID.
-b <block>: Specify by block number.
-r: Raw print.
-u: Print tree UUID.
-x: Extended output.
HISTORY
Developed as part of the BTRFS project starting around 2009, integrated into btrfs-progs (initially btrfs-tools). Evolved with BTRFS kernel features; subcommands like dump-tree added early for debugging copy-on-write trees and extents. Now in all modern distributions' btrfs-progs >=1.0.
SEE ALSO
btrfs(8), btrfsck(8), btrfstune(8)


