Re: Moving to a larger disk

From: Dave Cottlehuber <dch_at_skunkwerks.at>
Date: Sun, 21 May 2023 14:14:00 UTC
On Fri, 19 May 2023, at 07:39, Odhiambo Washington wrote:
> It's been years since I ever did this so allow me to post so that I can 
> gather ideas - newer ideas :)
>
> I have a 1TB disk, with UFS fs.
> I'd like to migrate to a 2TB SSD and retire/repurpose the 1TB disk.

Hi Odhiambo,

TLDR as already suggested, use dump/restore in base system, but with
UFS snapshots:

https://docs.freebsd.org/en/books/handbook/disks/#backup-basics
https://docs.freebsd.org/en/books/handbook/disks/#snapshots

This would look like:

- use bsdinstall(8) onto the new disk, so you get the boot loader
  and partitions all set up for you (looks like you did this already)
- use newfs(8) on the new root partition to empty it out again
- use mksnap_ffs(8) on the existing root partition
- mount the snapshot readonly back into the filesystem
- use dump(8) and restore(8) but from the snapshot mountpoint
- check /etc/fstab in the restored partition for correct labels
  as your existing disk is ada0 and the new one is da0

https://forums.freebsd.org/threads/using-ufs-snapshots.3317/ explains
this nicely.

Using dd will, probably take longer and, transfer 1TiB instead of the
actual ~ 260GiB you actually have in use. With dump/restore you can
tweak the config of the file system when you create it with newfs.

A+
Dave