Skip to content

Add --file-layout (-f) option to zdb(8) to display the#18264

Open
kithrup wants to merge 1 commit intoopenzfs:masterfrom
KlaraSystems:klara/zdb-raidz-layout
Open

Add --file-layout (-f) option to zdb(8) to display the#18264
kithrup wants to merge 1 commit intoopenzfs:masterfrom
KlaraSystems:klara/zdb-raidz-layout

Conversation

@kithrup
Copy link
Contributor

@kithrup kithrup commented Feb 27, 2026

raidz file layout for a given file. This leverages the internal vdev_raidz_map_alloc() function to find the map of how the block data is laid out across the child disks.

The column entry for each row looks like:
+------------+
| D2 43 |
| 6020da |
+------------+
representing here the logical data column 2 that is 43 sectors high
starting at sector 0x6020da.

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: sean.fagan@klarasystems.com

Motivation and Context

This shows the layout of objects in a RAIDZ set. This was required to examine some data corruption.

Description

This leverages the internal vdev_raidz_map_alloc() function to find the map of how the block data is laid out across the child disks.

This is a re-creation of #16835

How Has This Been Tested?

I've run the ZFS tests for zdb, and I've run this particular command (zdb -f pool/ objid) for various pool layouts and object IDs.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Quality assurance (non-breaking change which makes the code more robust against bugs)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

@kithrup kithrup changed the title Adding the --file-layout (-f) option to zdb(8) to display the Add --file-layout (-f) option to zdb(8) to display the Mar 3, 2026
Displays the physical raidz block layout for a given file.
This leverages the internal vdev_raidz_map_alloc() function to find
the map of how the block data is laid out across the child disks.

The column entry for each row looks like:
+------------+
|  D2     43 |
|     6020da |
+------------+
representing here the logical data column 2 that is 43 sectors high
starting at sector 0x6020da.

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: sean.fagan@klarasystems.com
Signed-off-by: Don Brady <don.brady@klarasystems.com>
@allanjude allanjude force-pushed the klara/zdb-raidz-layout branch from f393f71 to 2457e6b Compare March 3, 2026 17:25
@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Code Review Needed Ready for review and testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants