Simulating bad sectors on file based storage device. How?

Artem Kuchin artem at artem.ru
Wed Feb 17 21:44:18 UTC 2021


18.02.2021 0:37, Walter von Entferndt пишет:
> At Mittwoch, 17. Februar 2021, 13:00:02 CET, Artem Kuchin
> <artem at artem.ru> wrote:
>> 15.02.2021 20:44, Alan Somers ?????:
>>> If you have SCSI disks, you can inject errors with `sysctl
>>> kern.cam.da.0.error_inject`.? If not, you can use gnop(8) to
>>> simulate a flaky disk.
>> gnop only allows to set probability, but i need an exact block in an
>> exact place.
>>
> Then RTSL & adjust a few lines in the source of gnop(8) (/usr/src/sys/
> geom/nop/g_nop.c, the error is inserted @line 158-167).  Search for
> "failprob".  It's very straightforward to adopt that and mimic a fail-
> on-specific-block# by copy & paste & adjust that functionality.
>
> Obviously you'll have to recompile all userland software that accesses
> the gnop(4), but these should be very few to none.


True! Thank you for the idea! I forgot i can program C :)

I can copy the source and just make my own utility.

Artem






More information about the freebsd-fs mailing list