Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Sep 2022 22:34:29 -0400
From:      "Kevin P. Neal" <kpn@neutralgood.org>
To:        Gary Aitken <freebsd@dreamchaser.org>
Cc:        questions@freebsd.org
Subject:   Re:  disk non-destructive bad-block write/fix?
Message-ID:  <YzJhNQn0NeFVjVdU@neutralgood.org>
In-Reply-To: <50ee834e-60ef-badb-68ce-f9aa589cd3cc@dreamchaser.org>
References:  <d687eb29-a3fb-7d91-a2c6-c1e4e1dc7e31@dreamchaser.org> <1f639118-4bb2-acfd-ab8e-e3aab9a79c9e@holgerdanske.com> <4e864eaefcb7dbed7bdf59d40920a0ab9b964bf5.camel@riseup.net> <50ee834e-60ef-badb-68ce-f9aa589cd3cc@dreamchaser.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Sep 25, 2022 at 08:09:23PM -0600, Gary Aitken wrote:
> Thanks all for your insights.
> 
> Unplugging / unmounting / reseating cables did not improve things.
> Nor did a different cable.
> I eventually got a complete backup, but I will be migrating off that disk.
> I already am rotating backup media, so that one will rotate out.
> 
> On 9/19/22 11:45 PM, grarpamp wrote:
> > Store a sha256 of all the files, read them back to verify and compare
> > to that.
> 
> Can you post a script that does this?  (Save me (and others?) some effort).
> If you already do this, what is the sequence?
>    1. generate list of all files to be backed up, e.g.
>         find /home/me/ | grep -iv -f /home/me/backup_ignores.txt >files.txt
>    2. perform the sums individually and then sum the sums.
>       This one is harder because of blanks and other stupid characters in
>       some file names.
>         cat files.txt | xargs -L 1 sha256 -r >file-sums.txt (doesn't work)

find $FILESYSTEM -type f -exec sha256 -r {} + >file-sums.txt

This avoids the spaces and special characters in the filenames issue.

You can also replace the "+" with a (no quotes) "\;" to run the program
with only a single argument. This could be a shell script that handles
excluding files in your list.

A friend of mine has a script to do hashes of every file in a filesystem
and stores the result in each file's extended attributes. It's a short hop
from there to a script that verifies that no file has been corrupted.  He
uses consumer grade SATA spinning rust, you see, and he has seen files
corrupted.

I second the idea of using mtree if you don't need to be quite as fancy.
-- 
Kevin P. Neal                                http://www.pobox.com/~kpn/

Seen on bottom of IBM part number 1887724:
DO NOT EXPOSE MOUSE PAD TO DIRECT SUNLIGHT FOR EXTENDED PERIODS OF TIME.



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