Skip to content

btrfs-progs: Implement dump-raw command

Dāvis Mosāns linux-btrfs 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest1 patch 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1btrfs-progs: Implement dump-raw commandAndroid.mk Makefile cmds/commands.h +2 more+349 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/1] btrfs-progs: Implement dump-raw command

Currently there doesn't seem to be any tool to dump raw contents of a block, so here I implemented such command.
It also shows info about block's location which is useful if there's a need to patch block directly on disk.
It's based on dump-tree command - basically copied it with some changes.

Usage example:

$ btrfs inspect dump-raw -b 5242880 /dev/sdx | hexdump -n 64
btrfs-progs v5.10.1
block 5242880, mirror 0: reading 16384 bytes from device b0e0bb24-c654-4d79-872c-ad195bf995f1 at offset 5242880
0000000 1dbb f93d 69d7 d129 0000 0000 0000 0000
0000010 0000 0000 0000 0000 0000 0000 0000 0000
0000020 b993 bc9b 9fff 6e41 62ac dc4e 31e1 6adc
0000030 0000 0050 0000 0000 0001 0000 0000 0100
0000040

Can also dump corrupted block from speciific mirror

$ btrfs inspect dump-raw -b 5357568 --force -m 1 /dev/sdy | hexdump -n 64
btrfs-progs v5.10.1
block 5357568: using mirror 1 from 2 mirrors
block 5357568, mirror 1: reading 16384 bytes from device 002aa837-9fea-4b7a-9455-9be943bae1f5 at offset 5357568
checksum verify failed on 5357568 found 8242B9AD6E5A1308 wanted F1D148C22AF2D15B
0000000 d15b 2af2 48c2 f1d1 0000 0000 0000 0000
0000010 0000 0000 0000 0000 0000 0000 0000 0000
0000020 af51 62c3 876d 984a 0fbc 9237 8d29 ec8d
0000030 c000 0051 0000 0000 0001 0000 0000 0100
0000040

Dāvis Mosāns (1):
btrfs-progs: Implement dump-raw command

 Android.mk              |   3 +-
 Makefile                |   3 +-
 cmds/commands.h         |   1 +
 cmds/inspect-dump-raw.c | 341 ++++++++++++++++++++++++++++++++++++++++
 cmds/inspect.c          |   1 +
 5 files changed, 347 insertions(+), 2 deletions(-)
 create mode 100644 cmds/inspect-dump-raw.c
Signature · 1 line
2.30.1