Back to Cloud VPS Documentation

    Migrate from Hetzner Cloud to RamNode

    Complete step-by-step guide to migrating your Hetzner Cloud servers to RamNode Cloud VPS.

    Introduction

    This guide provides comprehensive instructions for migrating your virtual servers from Hetzner Cloud to RamNode Cloud. Whether you're seeking different datacenter locations, better pricing, or expanded infrastructure options, this guide covers everything needed for a successful migration.

    Hetzner Cloud provides rescue mode access which makes disk imaging straightforward. This guide presents two proven methods: complete disk imaging via rescue mode and live file synchronization using rsync.

    Supported Image Formats

    FormatDescriptionNotes
    RAWUncompressed disk imageLargest file size, fastest to create
    QCOW2QEMU Copy-On-Write format✓ Recommended - space efficient
    VMDKVMware virtual disk formatConvert from VMware exports
    VDIVirtualBox disk imageConvert from VirtualBox exports
    VHD/VHDXMicrosoft Hyper-V formatConvert from Azure/Hyper-V

    Recommendation: QCOW2 is recommended for most migrations due to its compression support. A 40GB disk with 8GB of actual data will result in a much smaller QCOW2 file compared to RAW format.

    Prerequisites

    • Active RamNode Cloud account (sign up at cloudorder.ramnode.com)
    • SSH access to your Hetzner Cloud servers
    • Access to Hetzner Cloud Console for rescue mode activation
    • qemu-img utility installed (for image conversion)
    • Sufficient storage space for disk images (local or cloud storage)
    • A web server or S3-compatible storage for hosting images during upload

    1Rescue Mode with Disk Imaging (Recommended)

    This method uses Hetzner's rescue mode to boot outside the main OS and create a complete disk image. This is the recommended approach for complete system migrations with all configurations preserved.

    Step 1: Create a Snapshot (Backup)

    Before starting, create a snapshot of your server in the Hetzner Cloud Console:

    1. Log into the Hetzner Cloud Console
    2. Select your server
    3. Go to Snapshots tab
    4. Click Create Snapshot
    5. Wait for the snapshot to complete

    Step 2: Enable Rescue Mode

    1. In the Hetzner Cloud Console, select your server
    2. Go to the Rescue tab
    3. Select linux64 as the rescue system
    4. Click Enable rescue & power cycle
    5. Note the temporary root password displayed

    Step 3: Connect via SSH

    Connect to your server using the rescue mode credentials:

    ssh root@YOUR_SERVER_IP
    # Enter the temporary password shown in the console

    Step 4: Identify Disk Devices

    List available disk devices:

    fdisk -l
    # or
    lsblk

    Your main disk is typically /dev/sda on Hetzner Cloud servers. Note the disk size for later.

    Step 5: Install Required Tools

    The rescue system includes most tools, but ensure qemu-utils is available:

    apt-get update
    apt-get install -y qemu-utils

    Step 6: Create QCOW2 Image

    Create a compressed QCOW2 image of the disk:

    # Create the image (this may take a while depending on disk size)
    qemu-img convert -f raw -O qcow2 -c /dev/sda /tmp/hetzner-server.qcow2
    
    # Check the resulting image size
    ls -lh /tmp/hetzner-server.qcow2

    Note: The rescue system has limited disk space in /tmp. For large images, you may need to stream directly to remote storage or use attached volumes.

    Step 7: Transfer Image (Option A - Direct Upload)

    Stream directly to a remote server or S3-compatible storage:

    # Option 1: SCP to a remote server
    scp /tmp/hetzner-server.qcow2 user@remote-server:/path/to/destination/
    
    # Option 2: Upload to S3-compatible storage (requires aws-cli)
    apt-get install -y awscli
    aws s3 cp /tmp/hetzner-server.qcow2 s3://your-bucket/hetzner-server.qcow2

    Step 7: Transfer Image (Option B - Serve via HTTP)

    Alternatively, serve the image temporarily via HTTP:

    # Install and start a simple web server
    apt-get install -y nginx
    ln -s /tmp/hetzner-server.qcow2 /var/www/html/
    systemctl start nginx
    
    # The image is now available at:
    # http://YOUR_SERVER_IP/hetzner-server.qcow2

    Security Notice

    This temporarily exposes your disk image publicly. Complete the upload to RamNode quickly and exit rescue mode immediately afterward.

    Step 8: Exit Rescue Mode

    After successfully uploading the image, disable rescue mode in the Hetzner Console and reboot your server to return it to normal operation.

    2Live System with rsync

    For simpler setups, application-level migrations, or when you want to change the operating system during migration, you can use rsync to transfer files directly to a new RamNode instance.

    Step 1: Deploy RamNode Instance

    Create a new VPS on RamNode with the same operating system (or compatible version) as your Hetzner server.

    Step 2: Set Up SSH Key Authentication

    On your Hetzner server, copy your SSH key to the RamNode server:

    # Generate key if you don't have one
    ssh-keygen -t ed25519 -C "migration"
    
    # Copy to RamNode server
    ssh-copy-id root@RAMNODE_IP

    Step 3: Sync Files with rsync

    Execute rsync from your Hetzner server to transfer all files:

    rsync -avzP --numeric-ids \
      --exclude='/dev/*' \
      --exclude='/proc/*' \
      --exclude='/sys/*' \
      --exclude='/tmp/*' \
      --exclude='/run/*' \
      --exclude='/mnt/*' \
      --exclude='/media/*' \
      --exclude='/lost+found' \
      --exclude='/boot/efi/*' \
      / root@RAMNODE_IP:/

    Tip: For minimal downtime, run rsync multiple times. The first run copies everything, subsequent runs only sync changes. Do a final sync after stopping services.

    Step 4: Update System Configuration

    On the RamNode server, update critical configuration files:

    # Update hostname
    hostnamectl set-hostname your-new-hostname
    
    # Update /etc/hosts
    nano /etc/hosts
    
    # Reset machine-id for cloud-init
    rm /etc/machine-id
    systemd-machine-id-setup
    
    # Update network configuration (if static IP was used)
    # For Ubuntu/Debian with Netplan:
    nano /etc/netplan/50-cloud-init.yaml
    
    # Apply network changes
    netplan apply

    Step 5: Reinstall and Update GRUB

    Ensure the bootloader is properly configured:

    # Ubuntu/Debian
    update-grub
    grub-install /dev/vda
    
    # CentOS/Rocky/Alma
    grub2-mkconfig -o /boot/grub2/grub.cfg
    grub2-install /dev/vda

    Uploading Images to RamNode Cloud

    Via Cloud Control Panel

    1. Log into the Cloud Control Panel at cloud.ramnode.com
    2. Navigate to Compute → Images
    3. Click Create Image
    4. Select URL as the source and enter the URL where your image is hosted
    5. Configure image details:
      • Name: Descriptive name (e.g., "hetzner-webserver-ubuntu22")
      • Format: Select QCOW2
      • Minimum disk size: Match or exceed your original Hetzner disk size
      • Minimum RAM: Specify the minimum RAM required
    6. Click Create Image and wait for the upload to complete

    Large Image Uploads (Over 2GB)

    For images larger than 2GB, use the OpenStack CLI for reliable uploads:

    # Download your authentication file from the Cloud Control Panel
    # Navigate to: API Access → Download OpenStack RC File
    
    # Install the OpenStack CLI
    pip install python-openstackclient
    
    # Source your authentication file
    source your-openrc.sh
    
    # Upload the image
    openstack image create \
      --disk-format qcow2 \
      --container-format bare \
      --file hetzner-server.qcow2 \
      "hetzner-migration-image"
    
    # Verify the upload
    openstack image list

    For more details on using the OpenStack CLI, see our OpenStack API Guide.

    Deploying Your Migrated Instance

    After the image upload completes:

    1. Navigate to Compute → Instances → Create Instance
    2. Select your custom image from the Images tab
    3. Choose a plan with equal or greater specifications than your original Hetzner server
    4. Select your preferred datacenter location
    5. Configure networking, SSH keys, and other options
    6. Click Create Instance
    Hetzner TypeSpecsRamNode Equivalent
    CX111 vCPU, 2 GB RAMCloud VPS 2GB+
    CX212 vCPU, 4 GB RAMCloud VPS 4GB+
    CX312 vCPU, 8 GB RAMCloud VPS 8GB+
    CX414 vCPU, 16 GB RAMCloud VPS 16GB+
    CX518 vCPU, 32 GB RAMCloud VPS 32GB+

    Post-Migration Tasks

    Verify System Boot

    Access the VNC console to verify your system boots correctly. Check for any boot errors or driver issues.

    Network Configuration

    If your image has cloud-init installed, network configuration should be automatic. Otherwise, you may need to:

    • Update /etc/network/interfaces or Netplan configuration
    • Configure DHCP on network interfaces
    • Update DNS resolver settings in /etc/resolv.conf

    Reinstall Cloud-Init (If Needed)

    If cloud-init was previously configured for Hetzner, reset it to work with RamNode's metadata service:

    Ubuntu/Debian:

    # Clean existing cloud-init data
    cloud-init clean --logs
    rm -rf /var/lib/cloud/*
    
    # Reboot to reinitialize
    reboot

    If that doesn't work, fully reinstall:

    apt purge cloud-init
    rm -rf /etc/cloud /var/lib/cloud
    apt install cloud-init

    Update DNS Records

    Update your DNS records to point to the new RamNode IP address. Consider lowering TTL values before migration to minimize downtime during the DNS propagation period.

    Verify Services

    Test all critical services to ensure they function correctly:

    • Web servers (Apache, Nginx)
    • Database services (MySQL, PostgreSQL)
    • Mail services (if applicable)
    • SSL/TLS certificates and renewal (certbot)
    • Cron jobs and scheduled tasks
    • Application-specific services

    Troubleshooting

    Instance Won't Boot

    • Verify virtio drivers are installed (check VNC console for boot errors)
    • Ensure the bootloader (GRUB) is properly configured for virtio devices
    • Check that the image isn't corrupted (verify checksum if available)
    • Verify disk size meets minimum requirements specified during image upload
    • Check fstab for UUID references that may have changed

    Network Not Working

    • Verify network interface names (may change from ens3 to eth0 or similar)
    • Configure DHCP on the primary network interface
    • Check that cloud-init networking is enabled and not blocked
    • Remove any hardcoded IP configurations from Hetzner
    • Check for Hetzner-specific network scripts in /etc/network/

    Disk/Filesystem Issues

    • Use resize2fs to expand filesystem if disk was enlarged
    • Run fsck if filesystem errors are reported during boot
    • Update /etc/fstab if it references Hetzner-specific UUIDs or paths
    • Check for LVM volumes that may need activation

    SSH Access Issues

    • Use VNC console to access the system if SSH fails
    • Check SSH daemon status: systemctl status sshd
    • Verify SSH port isn't blocked by firewall rules
    • Regenerate SSH host keys if needed: ssh-keygen -A

    Best Practices

    PracticeRecommendation
    Create Snapshots FirstAlways snapshot your Hetzner server before making any changes
    Minimize Image SizeClean logs, temp files, and package caches before imaging
    Use QCOW2 FormatMore space-efficient than RAW, faster uploads
    Test Before SwitchingDeploy and test on RamNode while keeping Hetzner running
    Lower DNS TTLReduce TTL days before migration for faster DNS propagation
    Document EverythingNote services, ports, configurations before migration
    Plan for RollbackKeep Hetzner instance available for at least 48 hours after migration

    Need Professional Assistance?

    Our Professional Services team can help with complex migrations, ensuring minimal downtime and proper configuration.

    Related Documentation