btrfs-map-logical - Linux
Overview
btrfs-map-logical is a command-line utility for the Btrfs file system that maps logical extents to their physical location on the disk. It is primarily used for debugging purposes and can aid in diagnosing file system issues or understanding how data is laid out on a Btrfs volume.
Syntax
btrfs-map-logical [options] <device> <offset>
Options/Flags
- -b, –bytes: Output the size of the logical extent in bytes.
- -G, –blocks: Output the size of the logical extent in blocks.
- -e, –extent: Print the extent of the logical extent in the form of
[start,length]
. - -f, –file: Map the logical extent to a file ID instead of a device.
- -h, –help: Print usage information and exit.
- -i, –inode: Map the logical extent to an inode ID instead of a device.
- -l, –link: Map the logical extent to a link ID instead of a device.
- -o, –output: Specify the output format. Available options are "json" and "text".
- -r, –raw: Print the raw output without any formatting.
- -s, –subvolume: Map the logical extent to a subvolume ID instead of a device.
- -T, –tree: Print the tree of the logical extent.
- -t, –type: Print the type of the logical extent.
- -v, –verbose: Print additional information.
Examples
To map a logical extent to its physical location:
btrfs-map-logical /dev/sda1 1000000
To output the size of the extent in bytes:
btrfs-map-logical -b /dev/sda1 1000000
To map the extent to an inode:
btrfs-map-logical -i /dev/sda1 1000000
To print the tree of the extent:
btrfs-map-logical -T /dev/sda1 1000000
Common Issues
One common issue when using btrfs-map-logical is that it requires root privileges to run. Make sure to execute the command with sudo
or as the root user.
Integration
btrfs-map-logical can be combined with other Btrfs commands and tools for advanced tasks. For example, it can be used with btrfs-inspect
to inspect the internal structures of a Btrfs file system.
Related Commands
- btrfs-inspect: Inspect the internal structures of a Btrfs file system.
- btrfs-find-root: Find the root node of a Btrfs file system.