Simulating bad sectors on file based storage device. How?

Ira Cooper ira at wakeful.net
Wed Feb 17 19:22:16 UTC 2021


A suggestion:

Use ISCSI to emulate the SCSI layer, and use the target to emulate the
errors you want to emulate.

I believe the ports collection has at least one userland target in it.

-Ira

On Wed, Feb 17, 2021 at 2:02 PM Ravi Pokala <rpokala at freebsd.org> wrote:

> -----Original Message-----
> 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?
> Message-ID: <46b52475-385f-5931-f425-fd546dd5b377 at artem.ru>
> Content-Type: text/plain; charset=utf-8; format=flowed
>
>     gnope only allows to set probability, but i need an exact block in an
>     exact place.
>
> ATA, NVMe, and SCSI all have commands to mark specific ranges of logical
> sectors as unreadable.
>
> - ATA: WRITE_UNCORRECTABLE_EXT (has both report-failure-instantly and
> perform-real-error-recovery-before-reporting-failure modes)
>
> - NVMe: Write Uncorrectable
>
> - SCSI: WRITE_LONG (has both report-failure-instantly and
> perform-real-error-recovery-before-reporting-failure modes)
>
> The base system does not contain programs to issue those commands
> specifically, but the commands can be assembled by hand and sent to the
> drive via `camcontrol cmd' (ATA, SCSI) or `nvmecontrol io-passthru' (NVMe).
> Obviously, assembling those commands would require spending some time with
> the ATA specs from t13.org, the NVMe specs from nvme.org, or the SCSI
> "Block Commands" spec from t10.org.
>
> It should go without saying that those commands are dangerous, because by
> definition they destroy data. Use with caution after deep study of the docs
> in question.
>
> -Ravi (rpokala@)
>
>
>     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.
>     >
>     > On Mon, Feb 15, 2021 at 10:36 AM Artem Kuchin <artem at artem.ru
>     > <mailto:artem at artem.ru>> wrote:
>     >
>     >     Hello!
>     >
>     >     Is there a way to build a file base storage device (for example,
> file
>     >     based zfs mirror) and then simulate a bad sector for one of the
>     >     mirror
>     >     sides?
>     >
>     >     Artem
>
>
>
> _______________________________________________
> freebsd-fs at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-fs
> To unsubscribe, send any mail to "freebsd-fs-unsubscribe at freebsd.org"
>


More information about the freebsd-fs mailing list