2026-02-26 Clone a virtual machine from inside it ================================================= I want to move my virtual machine from hoster edis.at to hoster hosting.de. I'm using Debian stable/13/Trixie. Both of these are KVM but I am just client, I don't have access to their management tools. So how to go about it? This page does not have an answer to the question. If you know what I'm missing, let me know. The two servers are sibirocobombus (source) and new-home (target). My idea is that I will just copy the whole filesystem first, using rsync. Many of the SQLite databases will be borked but that doesn't matter. I make the target system bootable and reboot. Verify that this works. This is where I'm stuck. The plan is then to finish the migration of database-using services since all the services using SQLite databases are borked. I shut down all these services (GoToSocial, 3× Xobaque, The Lounge, possibly others) on both the source and the target system. Then copy the whole filesystem again, using rsync. This should be much faster sind almost all the other files are unchanged. Then restart the services on the target server and don't restart them on the source server. On the source system: mkdir /mnt/src mount --options ro --bind / /mnt/src On the target system: mkdir /mnt/target On the source system again: rsync -aHAXSz \ --delete \ --info=progress2 \ --numeric-ids \ --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","/etc/fstab","/etc/udev/rules.d/*","/etc/network/*","/lib/modprobe.d/*"} \ /mnt/src/ new-home:/mnt/target/ On the target system: cd /mnt/target for i in /dev /dev/pts /proc /sys /run; do mount --bind $i .$i; done chroot /mnt/target update-grub update-initramfs -u exit reboot This reboots me back into the original target system. /mnt/target still exists and hasn't replaced the whole system, which is what I had expected. What do I need to do in order to make it happen? mv all the files in /mnt/target into the correct place? After all, /mnt/target doesn't contain /dev/*, /proc/*, /sys/*, /tmp/*, /run/*, /mnt/*, /media/*, /lost+found, /etc/fstab, /etc/udev/rules.d/*, /etc/network/*, /lib/modprobe.d/*. I should't overwrite any of the directories with an empty directory in /mnt/target, however. What am I doing. #Administration 2026-02-26. OK, I think the first step in getting there is that I really have to start a recovery system for the target. And hosting.de provides for this! So I switch into the recovery system. Mount the target as /mnt/target and install rsync. mkdir mnt/target mount /sda/sda3 /mnt/target apt update apt install rsync Now I can send over stuff again. Since I'm not overwriting /boot, /initrd*, /vmlinuz* I kinda think I should just be able to reboot this system. Actually, no. Rebooting gets me the rescue system. Strange! Well, I can go into the rescue system again and try the following, based on Restoring from a tar Backup . Use lsblk to verify the device names. # Restore the entire system (must boot from a rescue system) # 1. Mount the target partition mount /dev/sda3 /mnt # 2. Extract the backup to the target partition # skip, I guess # 3. Recreate necessary directories mkdir -p /mnt/{proc,sys,dev,run,tmp,mnt,media} # 4. Reinstall the bootloader mount --bind /dev /mnt/dev mount --bind /dev/pts /mnt/dev/pts mount --bind /proc /mnt/proc mount --bind /sys /mnt/sys mount --bind /run /mnt/run chroot /mnt grub-install /dev/sda update-grub exit I sort of think I've done this before? We'll see. Also, where is initramfs-update? root@rescue:/# grub-install /dev/sda Installing for i386-pc platform. Installation finished. No error reported. root@rescue:/# update-grub Generating grub configuration file ... Found linux image: /boot/vmlinuz-6.12.38+deb13-amd64 Found initrd image: /boot/initrd.img-6.12.38+deb13-amd64 Warning: os-prober will not be executed to detect other bootable partitions. Systems on them will not be added to the GRUB boot configuration. Check GRUB_DISABLE_OS_PROBER documentation entry. Adding boot menu entry for UEFI Firmware Settings ... done The output looks OK. Rebooting still gets me the rescue system. Let's try dashboard again. Reset the system. The VNC terminal shows the hostname "sibirocobombus"! Yay. But I cannot ping the machine. Something broke. Some networking configuration I should have copied from the rescue system, I assume. Actually, if I use chroot /mnt I immediately lose network access. How annoying. I made some more changes, trying to find the key difference between the two systems and eliminating it. cp /etc/resolv.conf /mnt/etc/resolv.conf rm /mnt/etc/systemd/network/* rm -rf /mnt/lib/systemd/network cp -r /lib/systemd/network /mnt/lib/systemd/network By now, if I'm in the chroot, I have network access. I can run apt update && apt upgrade, for example. But if I boot the system, I have no network access. With the web terminal, I'm looking at the startup screen and I see a whole lot of services failing to start up. Not a problem, I thought. Of course gotosocial is going to fail. But I also see conntrackd fails to start as well. Uh. I think I need to disable the firewall before restarting it? 2026-02-27. I'm still at a loss. I don't see how I can make the image I have bootable on a different infrastructure. This feels very uncomfortable. My system backup is not portable at all. 😓 So what I think I will have to do is reinstall Debian stable and bring back every single service, one by one. 2026-02-28. I went into the rescue system, chroot into "my" system, started the fail2ban server and unbanned all. Rebooted into "my" system and still had the same problem. Terminal window in the web dashboard of the hosting provider shows the login prompt showing "my" hostname, but I can no longer reach it. I guess it's time to rebuild it, using rsync selectively. Domain by domain. My notes are here: Paraelectrobombus. 2026-03-21. There are still some tasks left to do. Will this entire thing take more than a month? Only time will tell. 😥