I have ddrescue image and want to recover data from it. But the image is taking wrong sector size it should take 4096 and the partitions are btrfs partitions. How to change the sector size?

$sudo losetup -P -f 3TB.dump
$sudo fdisk -l /dev/loop0
Disk /dev/loop0: 450,8 GiB, 484017766400 bytes, 945347200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xe7b796e0

Device       Boot     Start       End   Sectors  Size Id Type
/dev/loop0p1 *          256 268435711 268435456  128G 83 Linux
/dev/loop0p2      268435712 536871167 268435456  128G 83 Linux
/dev/loop0p3      536871168 601494527  64623360 30,8G  b W95 FAT32

1 Answer 1


man losetup

-b, --sector-size size
Set the logical sector size of the loop device in bytes (since Linux 4.14). The option may be used when create a new loop device as well as stand-alone command to modify sector size of the already existing loop device.

  • I have 4.15.15-300.fc27.x86_64 but this option is not available. Apr 14, 2018 at 22:39
  • 1
    @KiranTelukunta If it is an option for you to write a small C program: The relevant syscall of losetup -b 4096 /dev/loop0 is ioctl(3, LOOP_SET_BLOCK_SIZE, 4096). Apr 14, 2018 at 23:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.