Re: Moving to a larger disk

From: Matthew Seaman <matthew_at_FreeBSD.org>
Date: Fri, 19 May 2023 12:58:09 UTC
On 19/05/2023 13: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?
> 

That's not a bad plan if you can afford to take the machine down for the 
entire time needed to effect all the copying and checking.

Given you can dump from a /snapshot/ on the old disk, you have the 
choice of either keeping the old drive frozen and unchanging during the 
whole process, or allowing some traffic to the old drive while the 
copying is going on, but running a fix-up step at the end to make sure 
everything is perfectly synched.

If you're going for the former, I'd suggest either booting from external 
media, or performing the whole operation from single-user mode.  Either 
should work well to prevent any updates to your old disk during the process.

If the latter, then you should ultimately be able to do an additional 
final step of a much smaller incremental dump/restore (or use a tool 
like rsync(1)) to ensure everything is perfectly synchronised.  You 
still need to take measures to freeze the old hard drive during this 
final fixup copy if you want absolutely perfect consistency.

Also, if the new drive is going to become your boot drive, then use 
FreeBSD installation media to build a pristine new FreeBSD system on it, 
including all of the boot loader stuff, etc.  Use the same OS version as 
your old drive, or as close as you can get it. You can then proceed as 
above to overwrite the filesystems with the contents of your old hard 
drive, and everything should come up properly bootable with minimal effort.

Don't attempt to combine transferring the system onto a new drive with 
any sort of system update in one step -- first, get the initial copy 
right, and only then upgrade the new disk content as a separate 
operation.  Your old disk should still be there and able to act as a backup.

	Cheers,

	Matthew