LinuxCommandLibrary

xfs_bmap

Show block mapping for a file

SYNOPSIS

xfs_bmap [ options ] file ...

PARAMETERS

-l
    List extents in logical block order (this is the default behavior). Logical block order follows the sequential order of data within the file.

-p
    List extents in physical block order, showing their actual location on the disk and useful for understanding fragmentation.

-q
    Query file system for extent size, allocation group size, and other block information. When this option is used, no file argument should be provided.

-v
    Produce verbose output, providing more detailed information for each extent, such as the logical start block, block count, and physical start block.

-n
    Suppress the header row from the output, displaying only the extent data for scripting or parsing.

-A
    Report block maps for all forks of the file: data, attribute, and realtime forks (if they exist for the file).

-a
    Report the block map specifically for the attribute fork of the file. This fork stores extended attributes associated with the file.

-d
    Report the block map specifically for the data fork of the file (this is the default behavior).

-r
    Report the block map specifically for the realtime fork of the file. This is only applicable if the XFS filesystem was created with a realtime device and the file resides on it.

-f
    When used with the -A option, prints the name of the fork along with its block map, clarifying which fork's data is being displayed.

DESCRIPTION

The xfs_bmap command is a utility used on Linux systems with XFS file systems to display the block map of a specified file. A block map shows how a file's data is laid out on the disk, represented as a series of extents. Each extent is a contiguous range of disk blocks. This tool is invaluable for understanding file fragmentation, how efficiently space is being used, and for diagnosing performance issues related to disk I/O.

It can show the logical-to-physical block mapping, allowing users to see where on the physical disk a file's data resides. Beyond data forks, it can also report on attribute and realtime forks, providing a comprehensive view of a file's on-disk structure and physical allocation.

CAVEATS

The xfs_bmap command is specific to XFS file systems. It will not work on other file system types (e.g., ext4, Btrfs, NTFS).
For files on a realtime device, the -r option must be used to view the realtime fork's map, provided the filesystem was configured with one. Access to the specified file(s) requires appropriate read permissions for the command to function correctly.

HISTORY

xfs_bmap is part of the xfsprogs suite, the collection of user-space utilities for managing XFS file systems. XFS, originally developed by Silicon Graphics (SGI) in the early 1990s, was designed for high-performance computing environments and became integrated into the Linux kernel in 2001. The xfsprogs utilities, including xfs_bmap, have continuously evolved alongside the XFS file system to provide robust management and diagnostic capabilities, adapting to new XFS features and kernel advancements, ensuring its continued relevance for XFS administration.

SEE ALSO

xfs_fsr(8), xfs_info(8), xfs_growfs(8), xfs(5)

Copied to clipboard