I have a running GCP VM that I need to migrate to Hetzner Cloud, both Ubuntu 22.04. I have three options here:
- Take an image and exported as QCOW2 from GCP, then some how converted to ISO and uploaded it to Hetzner so their support can download it and make it available as a custom image for me.
- Use the partition migration method from Hetzner docs here: https://docs.hetzner.com/cloud/servers/getting-started/migrate-partition/
- Use rsync directly from Hetzner to sync everything from GCP:
rsync -aAXvP --progress --rsync-path="sudo rsync" \
--max-alloc=8G --partial --partial-dir=/tmp/rsync-partials \
--exclude={"/tmp/*","/proc/*","/sys/*","/run/*","/var/tmp/*","/etc/fstab","/etc/netplan/*","/etc/network/interfaces","/etc/default/grub","/boot/grub/*","/dev/*"} \
-e "ssh -i path-to-ssh-key" \
user@gcp-ip:/ / > rsync.log 2>&1
then grub-intall update-grub
I tried the rsync method, but for some reason the vm failed to boot and I got:
GRUB_FORCE_PARTUUID set, initrdless boot failed. Attempting with initrd.
When I traced the issue, I found that after update grub, the /boot/grub/grub.cfg changed and points at PARTUUID that mismatches the disk PARTUUID. Also, I did't exclude initrd.img so it's overwritten from GCP, but initrd.img-6.8.0-51-generic is not. I don't know what I'm missing that causes the issue. I don't know what if I excluded the whole boot directory from rsync, will everything else (data and configurations) work fine?
I'm newbie in Linux and in Cloud actually, so I want to hear your opinion and if you have a suggestion for the migration or for solving the rsync issue.
Note: I figure out that when I grub-install update-grub, the grub configurations generated based on GCP VM disk not the Hetzner new server's disk.