Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Dec 2023 10:28:22 +0100
From:      Michael Grimm <trashcan@ellael.org>
To:        freebsd-fs@freebsd.org
Cc:        Miroslav Lachman <000.fbsd@quip.cz>, Alexander@leidinger.net
Subject:   Re: Howto migrate a FreeBSD cloud instance to another one without native FreeBSD support?
Message-ID:  <40702ABB-1DD2-44D3-B33E-0EAB60D19B5C@ellael.org>
In-Reply-To: <a9b41da0fc536a57f038fc8563306e21@Leidinger.net>
References:  <4A6398FE-5DC1-45A1-85A9-7C5054CF5BF7@ellael.org> <cd7491fd-aec6-4023-9e93-4de3f59f6bbe@quip.cz> <A54A7120-FEA8-4E67-9613-2C27A665B90F@ellael.org> <a9b41da0fc536a57f038fc8563306e21@Leidinger.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Alexander Leidinger <Alexander@leidinger.net> wrote
> 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, =
=E2=80=A6) 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.
>=20
> 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=3D/dev/sda <imagefile" or "zstd <imagefile | ssh =
me@target unzstd \| dd of=3D/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=3Don on the pool.

I finally succeeded in migrating to a new cloud instance by following my =
initial plan:

1) Using Linux functionality in rescue=20

	a) Repartition the target disk using gdisk:
		Partition 1: EF00  EFI system partition
		Partition 2: A504 FreeBSD ZFS

	b) mkds.fat Partition 2

	c) copy loader.efi from old server to /EFI/BOOT/BOOTX64.efi in =
Partition 2

	d) Creation of target zpool

2) Migration of old zfs filesystem to target ZFS filesystems (in rescue)

	zfs send from target | zfs receive

3) Modification of rc.conf et al.

As proof on concept I did follow =
https://community.hetzner.com/tutorials/freebsd-openzfs-via-linux-rescue =
first

Thanks and regards,
Michael




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?40702ABB-1DD2-44D3-B33E-0EAB60D19B5C>