Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Apr 2023 14:21:51 -0700
From:      David Christensen <dpchrist@holgerdanske.com>
To:        questions@freebsd.org
Subject:   Re: frequent disk error, need guidance
Message-ID:  <cbce76bf-7104-3ea7-f18b-057bd6ac79d1@holgerdanske.com>
In-Reply-To: <da04f7b2-2d8f-f7fb-5a00-e378a33e7a84@dreamchaser.org>
References:  <d5d43af7-58f4-656c-97c1-9d478db76096@dreamchaser.org> <20230415073315.7adfdddd.freebsd@edvax.de> <da04f7b2-2d8f-f7fb-5a00-e378a33e7a84@dreamchaser.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 4/15/23 12:25, Gary Aitken wrote:

> Thanks all who responded.
> Replaced the cable and retried, no change.
> Used different port with new cable, no change.
> Brought up, tested (smartctl --test=long), set up a new disk.
> Having never actually done this (I've always installed a newer version
> 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.
> 
> There are only 2 sata slots on the mobo, so I can't mount a third
> system, although I might be able to build a memstick and use that.
> Can I reboot in a read-only manner and do the above?
> Never done that, not sure what's involved.
> Is single-user mode sufficient?
> 
> Thanks,
> 
> Gary


Okay.  So, it sounds like the HDD is failing.


I would not attempt to clone the system drive of running OS -- it is a 
moving target, and I do not have the expertise.


If you boot a live drive, I expect dump/ restore of each file system 
could work.  But, you also have to deal with partitioning schemes, 
partition table(s), slices, partitions, boot loaders, file systems, 
etc..  AIUI Clonezilla facilitates such, but I am unsure of its FreeBSD 
support:

https://clonezilla.org/


I do imaging/ cloning the KISS way -- I shut down the computer, connect 
a large HDD, boot a live USB stick, and use dd(1) to copy the system 
drive blocks 0 through the end of the last slice to an image file on the 
external HDD.  I typically pipe the stream through gzip(1) to reduce 
storage space and run time.  I restore by copying the image file to the 
system drive or to a replacement drive.  I clone by copying the source 
drive or the image file to a target drive.  This process is complete for 
MBR partitioning.  For GPT partitioning, you must account for the backup 
partition table; the simplest approach is to copy the entire system drive.


David




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?cbce76bf-7104-3ea7-f18b-057bd6ac79d1>