Section: Btrfs Search Metadata (1)
btrfs-search-metadata - lookup btrfs metadata
program can be used to execute search queries
in order to look up metadata items of an online, mounted btrfs filesystem.
Unlike the btrfs inspect-internal dump-tree command, which directly reads from
only uses the kernel SEARCH ioctl function.
Besides being able to get any metadata slice from any tree, there are a number
of convenience presets that execute predefined search queries.
- -h, --help
Show the built-in help message and exit.
- --format keys|short|long
Print metadata items as keys only, as a short single line per item
(default), or long output with full contents of all fields.
Display all chunk items from the chunk tree, as well as the stripe items that
Display all block group items from the extent tree.
Display all device extent items from the device tree.
Display all information btrfs knows about a file or directory.
Display all information about an inode number in a subvolume tree.
Display all device items from the device tree.
Display all orphan items from the root tree.
Dump an arbitrary slice of metadata items from any tree. A key should be specified in the regular form as '(<objectid> <type> <offset>)', e.g. '(EXTENT_TREE ROOT_ITEM 0)'. The number -1 can be used instead of the maximum value for a field. This can be very useful when dumping all metadata items for a specific objectid. For example, what the inode subcommand does is searching with min-key '(<inum> 0 0)' and max-key '(<inum> -1 -1)'
Dump the contents of a block group (from the extent tree) from the specified virtual address of the start of the block group to its end. Use the block_groups subcommand to list block group addresses.
Dump the free space extents for a block group (from the free space tree) for the block group at the specified virtual address. Use the block_groups subcommand to list block group addresses.
This program is an example of what can be done using the python-btrfs library.
Source and documentation on github: https://github.com/knorrie/python-btrfs