Linux Tutorials

How to Migrate a KVM VPS From AlmaLinux 9 to CentOS 7 Imported Compute Resources Solusvm 2

How to Migrate a KVM VPS From AlmaLinux 9 to CentOS 7
How to Migrate a KVM VPS From AlmaLinux 9 to CentOS 7

If you are managing virtual machines and need to move one from AlmaLinux 9 to a server running CentOS 7, you may have noticed that there isn’t a straightforward migration tool. In some cases, especially with SolusVM or KVM virtualization, official migration methods aren’t supported between different compute resources.

But don’t worry—there’s a practical workaround. In this guide, we’ll walk through the process of creating a backup of your AlmaLinux 9 VM, transferring it to a CentOS 7 compute resource, and restoring it successfully.

Important Note: This method is not officially supported and hasn’t been fully tested in every production scenario. Perform these steps carefully and always keep a backup before starting.

Prerequisites

Before starting the migration, make sure you have:

  • A VM running AlmaLinux 9 on the source server.
  • A CentOS 7 server with KVM set up as the target compute resource.
  • Root SSH access to both servers.
  • Enough free storage space on the CentOS 7 target to store the VM disk.
  • Confirmation that the VM is powered off before you begin the backup.

Step 1: Create a New VM on the CentOS 7 Compute Resource

On your CentOS 7 target server, create a new virtual machine. Make sure the resources—CPU, RAM, and disk size—match your AlmaLinux 9 VM.

This ensures that when you restore the backup, it fits into the new VM disk properly.

Step 2: Locate the AlmaLinux 9 VM Disk

On the AlmaLinux 9 source server, find the VM’s disk path. Use the command below, replacing UUID with your VM’s UUID:

virsh domblklist UUID | grep sda | awk {'print $2'}

This command outputs the logical volume path, for example:

/dev/yourvg/kvm101_img

Step 3: Create a Backup of the VM Disk

Now, create a compressed backup of the AlmaLinux 9 VM disk using dd and gzip:

dd if=/dev/yourvg/kvm101_img | gzip | dd of=/home/kvm101_backup.gz bs=4096

This generates a compressed backup file in the /home/ directory.

Step 4: Transfer the Backup to the CentOS 7 Target Server

Copy the backup file from AlmaLinux 9 to your CentOS 7 compute resource using scp. Replace targetserverip with the IP of your CentOS 7 server:

scp -C /home/kvm101_backup.gz root@targetserverip:/home/

This may take some time depending on the size of your VM and your network speed.

Step 5: Restore the Backup on the CentOS 7 VM

Log in to the CentOS 7 server via SSH. Restore the compressed backup into the logical volume of the VM you created earlier:

dd if=/home/kvm101_backup.gz | gzip -d | dd of=/dev/yourvg/kvm101_img bs=4096

For SolusVM setups, the command might look like this:

dd if=/home/kvm312_backup.gz | gzip -d | dd of=/dev/solusvm/406_0 bs=4096

Make sure you replace the disk path with your actual VM’s disk path.

Step 6: Boot the VM on CentOS 7

After restoring, boot up the VM on your CentOS 7 compute resource. If everything was done correctly, your VM should now start with the operating system and data from AlmaLinux 9.

Note: SolusVM does not provide any official documentation for this migration process. However, I have personally tested this method and can confirm that it works successfully, even though it is not supported officially.

More Articles