Simulating bad sectors on file based storage device. How?

Kirk McKusick mckusick at mckusick.com
Thu Feb 18 01:03:53 UTC 2021


> Date: Tue, 16 Feb 2021 16:05:03 +0300
> From: Artem Kuchin <artem at artem.ru>
> To: Alan Somers <asomers at freebsd.org>
> Cc: freebsd-fs <freebsd-fs at freebsd.org>
> Subject: Re: Simulating bad sectors on file based storage device. How?
> 
>     gnope only allows to set probability, but i need an exact block in an 
>     exact place.

I have a hacked up version of gnop that adds the -F option to tell it
to fail any access to a specific set of sectors. So to make /dev/da0p1
into a disk that failed sectors 64-71, I use

# gnop create -F 64-71 /dev/da0p1

which creates /dev/da0p1.nop with the desired property. No damage
is done to /dev/da0p1 beyond the fact that no writes to the specified
range will be made.

If this driver would be useful, let me know and I'll dig it out.

	Kirk McKusick


More information about the freebsd-fs mailing list