Re: Moving to a larger disk

From: Tomek CEDRO <tomek_at_cedro.info>
Date: Sat, 20 May 2023 16:43:57 UTC
On Sat, May 20, 2023 at 10:45 AM Odhiambo Washington wrote:
> I did not hint on moving to ZFS. I just need to move from a 1TB to a 2TB disk.
> No intention of changing the FS.

1. Boot off external media cdrom/memstick.
2. Note old disk (i.e. /dev/ada0) and new disk (i.e. /dev/ada1) devices.
3. dd if=/dev/olddisk of=/dev/newdisk bs=100m status=progress (DO NOT
MESS UP OLD DISK AND NEW DISK :-) )
4. Power off the machine. Detach old disk and connect its data wire to
a new disk. New disk is now attached to the same port of the
controller (so it is now i.e. /dev/ada0 as the original one) and
byte-to-byte copy of the old one.
5. Boot the machine and all should work as before.
6. Note that partitions and filesystems may need a resize.

https://docs.freebsd.org/en/books/handbook/disks/#disks-growing

"dd" program will make byte-to-byte copy of "if" to "of",
status=progress will show you the progress so you know what happens,
"bs" sets the data chunk size that is important for usb transfers not
to take forever (if you dump a drive over external usb controller).

If you have broken disk with badsectors "ddrescue" is a nice tool that
will retry on failed transfers and tell you which sectors are broken
and skip them to copy what is possible to copy.

when disk is broken sometimes "badblocks" may help in non-destructive
read-only-mode as drive firmware may rewrite silently broken sectors..
just beware that when disk is really badly broken this tool will kill
the disk in seconds so always try the ddrescue in the first place to
rescue as much as possible.

have fun :-)

-- 
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info