On Fri, Dec 20, 2019 at 2:51 PM James Courtier-Dutton <james.dutton@xxxxxxxxx> wrote: > If I have a file on the disk that is using btrfs. > Is there an API call, IOCTL call that I can make to get from filename > to which sectors it is stored in? I'm not sure of a single tool. [chris@flap Documents]$ sudo filefrag -v UEFI_Spec_2_8_final.pdf Filesystem type is: 9123683e File size of UEFI_Spec_2_8_final.pdf is 18586279 (4538 blocks of 4096 bytes) ext: logical_offset: physical_offset: length: expected: flags: 0: 0.. 4537: 9798022.. 9802559: 4538: last,eof UEFI_Spec_2_8_final.pdf: 1 extent found [chris@flap Documents]$ sudo btrfs-map-logical -l $[9798022*4096] /dev/nvme0n1p7 mirror 1 logical 40132698112 physical 31475654656 device /dev/nvme0n1p7 [chris@flap Documents]$ sudo dd if=/dev/nvme0n1p7 bs=1 skip=31475654656 count=64 2>/dev/null | hexdump -C 00000000 25 50 44 46 2d 31 2e 36 0d 25 e2 e3 cf d3 0d 0a |%PDF-1.6.%......| 00000010 33 30 35 35 31 39 20 30 20 6f 62 6a 0d 3c 3c 2f |305519 0 obj.<</| 00000020 46 69 6c 74 65 72 2f 46 6c 61 74 65 44 65 63 6f |Filter/FlateDeco| 00000030 64 65 2f 46 69 72 73 74 20 31 31 37 39 2f 4c 65 |de/First 1179/Le| 00000040 [chris@flap Documents]$ -- Chris Murphy
