Simulating bad sectors on file based storage device. How?

Walter von Entferndt walter.von.entferndt at posteo.net
Wed Feb 17 21:37:52 UTC 2021


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.
-- 
=|o)  "Stell' Dir vor es geht und keiner kriegt's hin." (Wolfgang Neuss)




More information about the freebsd-fs mailing list