xfs_bmap(8)

πŸ’– xfs_bmap(8) πŸ’–

brought to you by the System Manager's Manual ✨

πŸŽ€ NAME πŸŽ€

okay so xfs_bmap is the tool that prints the block mapping for an XFS file πŸ—ΊοΈ it basically shows you where a file's bytes actually live on disk, bestie πŸ’…

πŸ¦‹ SYNOPSIS πŸ¦‹

xfs_bmap [ -adelpv ] [ -n num_extents ] file
xfs_bmap -V

🌸 DESCRIPTION 🌸

okay so xfs_bmap prints the map of disk blocks that files in an XFS filesystem are using 🧠 the map lists every extent the file uses, and it also shows the gaps in the file that don't have any blocks behind them. those gaps are called holes πŸ•³οΈ each line of the output looks like this:

extent: [startoffset..endoffset]: startblock..endblock

if a region is a hole, the startblock..endblock part gets swapped out for the word hole πŸ™ˆ also, every file offset and disk block is measured in 512-byte blocks, no matter what block size your filesystem is using. the math is consistent, periodt ✨

πŸ‘‘ OPTIONS πŸ‘‘

  • -a β€” slide in with this and it shows the file's attribute fork instead of the usual data fork πŸ’…
  • -e β€” this one goes after all the delayed allocation extents 🧚 it doesn't flush dirty pages to disk before it looks at the extent data. if you also use -v, the flags column will tell you which extents still haven't been allocated πŸ‘€
  • -l β€” adds a little tag to the end of every line that looks like this:
<nblocks>  blocks

nblocks is how long that extent is, counted in 512-byte blocks πŸ“ heads up though: if you're also using -v, this flag does absolutely nothing πŸ’€

  • -n num_extents β€” only shows you at most num_extents extents. if you leave this out, you get every single extent in the file 🫢
  • -p β€” this one hunts down all the unwritten (preallocated) extents that don't have any written data in them 🌈 with -v, the flags column marks which extents are preallocated/unwritten ✨
  • -v β€” verbose mode, bestie πŸ” it tacks some AG specific info onto each line in this format:
agno (startagoffset..endagoffset) nblocks flags

if you type -v a second time, you also get the flags legend πŸ³οΈβ€πŸŒˆ

  • -V β€” prints the version number and then bounces πŸ‘‹

🧚 SEE ALSO 🧚

xfs_fsr(8), xfs(5) πŸ’œ


and that's the tea, bestie! πŸ“ this was xfs_bmap(8) from the System Manager's Manual 🫢✨

πŸ“¦ where this page comes from