Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Feb 2021 14:22:04 -0500
From:      Ira Cooper <ira@wakeful.net>
To:        Ravi Pokala <rpokala@freebsd.org>
Cc:        "freebsd-fs@freebsd.org" <freebsd-fs@freebsd.org>
Subject:   Re: Simulating bad sectors on file based storage device. How?
Message-ID:  <CAAPGDwJ3AVGk6jLrvhytj%2BGvAvfkwwZDG8-b4kKdgA7XLy4kZg@mail.gmail.com>
In-Reply-To: <7DBD44C9-AB81-43AB-94C9-212577A765B3@panasas.com>

index | next in thread | previous in thread | raw e-mail

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@freebsd.org> wrote:

> -----Original Message-----
> Date: Tue, 16 Feb 2021 16:05:03 +0300
> From: Artem Kuchin <artem@artem.ru>
> To: Alan Somers <asomers@freebsd.org>
> Cc: freebsd-fs <freebsd-fs@freebsd.org>
> Subject: Re: Simulating bad sectors on file based storage device. How?
> Message-ID: <46b52475-385f-5931-f425-fd546dd5b377@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@artem.ru
>     > <mailto:artem@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@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-fs
> To unsubscribe, send any mail to "freebsd-fs-unsubscribe@freebsd.org"
>


help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAAPGDwJ3AVGk6jLrvhytj%2BGvAvfkwwZDG8-b4kKdgA7XLy4kZg>