Re: Moving to a larger disk

From: Odhiambo Washington <odhiambo_at_gmail.com>
Date: Fri, 19 May 2023 14:26:44 UTC
On Fri, May 19, 2023 at 4:21 PM Tim Daneliuk <tundra@tundraware.com> wrote:

> On 5/19/23 07:12, Robert Huff wrote:
> > Odhiambo Washington asks:
> >
> >>    I have a 1TB disk, with UFS fs.
> >>    I'd like to migrate to a 2TB SSD and retire/repurpose the 1TB disk.
> >
> >       [deletia]
> >
> >>    What is the easiest/best method to migrate?
> >
> >       What I would do:
> >       1) Put the new disk in an external drive dock.
> >       2) Format/label the new disk.
> >       3) Use dump/restore to transfer the contents; check for
> >               integrity.
> >       4) Unmount the new disk; shutdown computer; swap disks; boot.
> >
> >
> >       Anyone got a better plan?
> >
> >
> >                       Respectfully,
> >
> >
> >                               Robert Huff
>
>
> I dunno about "better" but I use a somewhat different strategy.  It's been
> a while but it's very roughly this:
>
> - Install the new drive by some means
> - Quiesce all highly active processes like web and db servers
> - dd if=/dev/old-drive of=/dev/new-drive
> - Shut down and remove old drive
> - Reboot from recovery media like a linux repair disk that has 'gparted'
> on it.
> - Use gparted to edit and resize (grow only) the relevant partition(s)
> - Reboot and use 'growfs' to make the full disk size available to the
> filesystem(s)
>

This sounds good and has given me an idea.
1. Get memstick.img and write that to a USB drive.
2. Install FreeBSD to the new disk.
3. Power down, and connect the new disk as a secondary drive.
4. Boot off the memstick and go to single-user mode. Mount the original
disk and the new disk
    mkdir /mnt1 /mnt2
    mount /dev/ada1p2 /mnt1   # Ensure this is the 1TB disk
    mount /dev/ada2p2 /mnt2   # Ensure this is the 2Tb disk
5. Do a dump:
    /sbin/dump -u -0af - /mnt1 | (cd /mnt2; restore -rf -)

If `clone` was available in the base, I would then do:

clone -d -y /mnt1 /mnt2

Does anyone see a problem with this approach?

-- 
Best regards,
Odhiambo WASHINGTON,
Nairobi,KE
+254 7 3200 0004/+254 7 2274 3223
"Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-)
[How to ask smart questions:
http://www.catb.org/~esr/faqs/smart-questions.html]