(no title)
iam-TJ | 1 year ago
To create simulated (2GiB) fake devices
fallocate -l 1G fff_test.flash
DEV=$(losetup --show --find fff_test.flash); echo $DEV
DEVNUM=$(stat -c %Hr:%Lr $DEV); echo $DEVNUM
With wrap-around sectors: dmsetup create --concise "fff_wrap,,,,0 2097152 linear $DEVNUM 0, 2097152 2097152 linear $DEVNUM 0"
With silently dropped writes: dmsetup create --concise "fff_drop,,,,0 2097152 linear $DEVNUM 0, 2097152 2097152 zero"
To test: fake_flash_finder.bash /dev/mapper/fff_wrap
Capacity mismatch at LBA 2097152, data wrapped around to block 0. Size is most likely really 1073741824 bytes
fake_flash_finder.bash /dev/mapper/fff_drop
Capacity mismatch at LBA 2097152, data does not match what was written. Size is most likely really 1073741824 bytes
To wipe the device if repeating tests: dd if=/dev/zero of=/dev/mapper/fff_wrap bs=64M status=progress conv=fdatasync
dd if=/dev/zero of=/dev/mapper/fff_drop bs=64M status=progress conv=fdatasync
To remove the device: dmsetup remove fff_wrap
dmsetup remove fff_drop
losetup --detach "$DEV"
rm fff_test.flash
[0] https://salsa.debian.org/-/snippets/732
No comments yet.