Re: Howto migrate a FreeBSD cloud instance to another one without native FreeBSD support?

From: Alexander Leidinger <Alexander_at_Leidinger.net>
Date: Tue, 26 Dec 2023 22:24:05 UTC
Am 2023-12-26 19:41, schrieb Michael Grimm:
> Miroslav Lachman <000.fbsd@quip.cz> wrote;
>> On 26/12/2023 15:22, Michael Grimm wrote:

> Sorry, if I haven't been clear enough:
> 
> #) I do want to migrate an existing ZFS pool (from one instance to 
> another (zfs send | zfs receive).
>    This I have done numerous times before.
> 
> #) New to me is the preparation of the target disk out of an 
> Ubuntu/Linux rescue system.
>    Namely, how to partition with Linux functionality (gdisk, cfdisk, …) 
> lacking gpart?
>    Namely, which kind of booting to use (legacy versus EFI)?
> 
>> And the second is: you can prepare small minimalistic FreeBSD image in 
>> Bhyve / VirtualBox etc. make a copy of it with dd and then write it by 
>> dd to your new instance's disk with the help of Linux rescue system. 
>> Then you can reboot to a minimalistic FreeBSD system, enlarge 
>> partition(s), use growfs or zpool / zfs enlargement and then finally 
>> move data from the old instance to this new instance by rsync, or zfs 
>> send, or whatever tool you prefer.
> 
> Thanks for this info, very much appreciated.

This is more or less what I did for such a case (local provider, not 
OVH): I used an existing FreeBSD system, created a file of a few GB, 
dd-ed /dev/zero to it completeley (for a compressed transfer), created a 
md(4) out of the file, partitioned it, created a root pool, installed 
FreeBSD into it, created a suitable rc.conf and such to boot from it, 
and wrote it to the linux rescue system on the target host "ssh -C 
me@target dd of=/dev/sda <imagefile" or "zstd <imagefile | ssh me@target 
unzstd \| dd of=/dev/sda" (it helps to create a authorized_keys entry on 
the target system). After rebooting into the system, a gpart recover and 
a gpart resize, followed by setting autoexpand=on on the pool.

Bye,
Alexander.

-- 
http://www.Leidinger.net Alexander@Leidinger.net: PGP 0x8F31830F9F2772BF
http://www.FreeBSD.org    netchild@FreeBSD.org  : PGP 0x8F31830F9F2772BF