Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Sep 2022 01:45:55 -0400
From:      grarpamp <grarpamp@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: disk non-destructive bad-block write/fix?
Message-ID:  <CAD2Ti28Bdm9kZq5umziXPizMXQdV5LZkYixogWmR0=6CBaM11w@mail.gmail.com>
In-Reply-To: <d687eb29-a3fb-7d91-a2c6-c1e4e1dc7e31@dreamchaser.org>
References:  <d687eb29-a3fb-7d91-a2c6-c1e4e1dc7e31@dreamchaser.org>

next in thread | previous in thread | raw e-mail | index | archive | help
> throwing a lot of errors

USB... reseat cables.

> Is there a way to exercise the free blocks on a ufs disk and move all
> defective ones to the bad-block list?

That's function of the hw, not the fs.

If you want to nuke the fs and do that to the disk
dd if=/dev/urandom of=/dev/da0 bs=1m

If not, then you can pray to hit most of the fs data areas with
dd if=/dev/urandom of=/mnt/bigrandfile bs=1m

but that's a prayer.

Better to buy enough media to have backups of backups.

> Or is that already happening in the above scenario?

Yes most firmwares modepages are set to automatically
write-reallocate, you can fiddle those using the scsi/ata/usb
spec and camcontrol.

Store a sha256 of all the files,
read them back to verify and compare to that.

> The disk is about 40% full

There's probably not a shrinkfs, and without checking where those
existing extents are, attempting to create a tailing 60% fs to
move the 40% into to write-realloc it... could end up footshot.

> wondering if the whole rest of it is trashed

dd if=/dev/da0 of=/dev/null bs=1m conv=noerror

But that's only a read test, not a write test.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAD2Ti28Bdm9kZq5umziXPizMXQdV5LZkYixogWmR0=6CBaM11w>