BTRFS-SEARCH-METADATA(1)

πŸ’– BTRFS-SEARCH-METADATA(1) πŸ’–

okay bestie, welcome to btrfs-search-metadata β€” she's a little legend from the Btrfs Search Metadata crew, and no cap, she's about to make looking up btrfs metadata feel like a group chat. let's get into it πŸ¦‹


✨ NAME ✨

btrfs-search-metadata β€” lookup btrfs metadata πŸ”


🌸 SYNOPSIS 🌸

btrfs-search-metadata <subcommand> <args>

πŸ’… DESCRIPTION πŸ’…

so the tea is: the btrfs-search-metadata program lets you run search queries to look up metadata items on an online, mounted btrfs filesystem. she's a whole different vibe from the btrfs inspect-internal dump-tree command, which reads straight from disk β€” nope, not her. btrfs-search-metadata only ever uses the kernel SEARCH ioctl function. that's it, that's the whole personality 🫢

and like, besides being able to pull any metadata slice from any tree (iconic), she also ships with a bunch of convenience presets that run predefined search queries for you, because she's a giver πŸ’–


🌈 GLOBAL OPTIONS 🌈

  • -h, --help β€” pops up the built-in help message and dips. bye bestie πŸ‘‹
  • --format keys|short|long β€” how you want your metadata items served: as keys only, as a short single line per item (this one's the default, fyi), or long output with the full contents of every single field. pick your fighter ✨

πŸ‘‘ SUBCOMMANDS πŸ‘‘

πŸ“ chunks <path>

displays all chunk items from the chunk tree, plus the stripe items they contain. the whole package deal πŸ’…

πŸ“ block_groups <path>

displays all block group items from the extent tree. every last one 🌸

πŸ“ dev_extents <path>

displays all device extent items from the device tree. slay ✨

πŸ“ file <path>

displays all the information btrfs knows about a file or directory. she knows everything, fr fr πŸ‘€

πŸ“ inode -t|--tree <tree> --inum <inum> <path>

displays all the info about an inode number in a subvolume tree. very demure, very mindful πŸŽ€

πŸ“ devices <path>

displays all device items from the device tree. periodt πŸ’œ

πŸ“ orphans <path>

displays all orphan items from the root tree. the orphans!! someone think of them 😭

πŸ“ dump -t|--tree <tree> [--min-key <MIN_KEY>] [--max-key <MAX_KEY>] <path>

dumps an arbitrary slice of metadata items from any tree. you specify a key in the regular form as '(<objectid> <type> <offset>)', like for real:

'(EXTENT_TREE ROOT_ITEM 0)'

the number -1 can be used instead of the maximum value for a field. this is lowkey super useful when you're dumping all the metadata items for one specific objectid. for example β€” and this is the whole trick behind the inode subcommand β€” she searches with min-key '(<inum> 0 0)' and max-key '(<inum> -1 -1)'. ate and left no crumbs 🧚

πŸ“ block_group_contents --vaddr <vaddr> <path>

dumps the contents of a block group (from the extent tree) starting at the specified virtual address of the start of the block group, all the way to its end. wanna know which addresses to use? run the block_groups subcommand and she'll list them for you πŸ’–

πŸ“ block_group_free_space --vaddr <vaddr> <path>

dumps the free space extents for a block group (from the free space tree) for the block group sitting at the specified virtual address. again β€” use the block_groups subcommand to list those block group addresses, bestie πŸ¦‹


⭐ SEE ALSO ⭐

this program is literally an example of what you can do with the python-btrfs library. iykyk πŸ’…

source and documentation on github, right here:

https://github.com/knorrie/python-btrfs

ok that's the whole page, go forth and search some metadata, you gorgeous main character πŸ”₯

and that's a wrap!! this was BTRFS-SEARCH-METADATA(1) from Btrfs Search Metadata, dated 2020 β€” mwah, love u, bye πŸŽ€πŸ’–βœ¨

πŸ“¦ where this page comes from