Re: frequent disk error, need guidance

From: Gary Aitken <freebsd_at_dreamchaser.org>
Date: Sun, 16 Apr 2023 01:50:41 UTC
On 4/15/23 13:47, John Levine wrote:
> It appears that Gary Aitken <freebsd@dreamchaser.org> said:
>> of fbsd in such cases), wanted to see if the following is a good way
>> to copy the old disk to the new one.
>>
>> mount /dev/ada1p2 /mnt/newsys
>> cd /mnt/newsys
>> dump -0 -f - /dev/ada0p2 | restore -r -Dv -f -
>>
>> However... this is a running system, which seems unlikely to produce
>> a consistent result.
> 
> I'd shut down to single user, make a /.snap directory, and do dump -L
> to tell it to make a snapshot before dumping.  That should work OK.

Thanks.
(Needed to mount /tmp read-write)
The -L didn't work because boot -s mounted the filesystem read-only;
at least that's what it claimed:

dump -0 -L -f - /dev/ada0p2 | restore -r -Dv -f -
Verify tape and initialize maps
   DUMP: WARNING: -L ignored for read-only filesystem

Not sure I understand that;
does -s normally start in read-only mode?
Has it always done that?  It's been quite a while since I did that.

In any case, I let the dump|restore go through, and it seems to have
been successful.  Booted into the restored system and running it now;
smartctl short test ok and doing long now.

It looks like the bad blocks/sectors were files in
   /var/db/freebsd-update/files/xxx.gz
I unzipped a file in that directory and it appears that they are the
saved files from the old system when upgrading.  Is that correct?
Any reason not to remove all files in
   /var/db/freebsd-update/files
since the upgraded to 12.x system has been running for several months
now?

Thanks,

Gary