Back to Cloud VPS Documentation

    Migrate from GCP to RamNode

    Complete step-by-step guide to migrating your Google Cloud Platform Compute Engine instances to RamNode Cloud VPS.

    Introduction

    This guide provides comprehensive instructions for migrating your virtual machines from Google Cloud Platform (GCP) Compute Engine to RamNode Cloud. Whether you're optimizing costs, seeking simpler pricing, or expanding your infrastructure options, this guide covers everything needed for a successful migration.

    GCP provides robust export tools through the gcloud CLI and Cloud Console. This guide presents two proven methods: exporting disk images to Cloud Storage and live file synchronization using rsync.

    Supported Image Formats

    FormatDescriptionNotes
    RAW (.tar.gz)GCP's native export formatCompressed raw disk image
    QCOW2QEMU Copy-On-Write format✓ Recommended for RamNode
    VMDKVMware virtual disk formatGCP export option available
    VHD/VHDXMicrosoft Hyper-V formatGCP export option available
    VDIVirtualBox disk imageConvert after export

    Recommendation: Export as RAW from GCP and convert to QCOW2 for upload to RamNode. This provides the best balance of compatibility and efficiency.

    Prerequisites

    • Active RamNode Cloud account (sign up at cloudorder.ramnode.com)
    • GCP project with Compute Engine instances
    • Google Cloud SDK (gcloud CLI) installed and configured
    • Cloud Storage bucket for image export
    • qemu-img utility installed (for image conversion)
    • Sufficient local storage for disk images

    1Disk Export via Cloud Storage (Recommended)

    This method exports your Compute Engine disk to Cloud Storage, where you can download and convert it for upload to RamNode. This is the recommended approach for complete system migrations.

    Step 1: Install Google Cloud SDK

    If not already installed, set up the gcloud CLI:

    # For Debian/Ubuntu
    echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
    curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
    sudo apt-get update && sudo apt-get install google-cloud-cli
    
    # Authenticate
    gcloud auth login
    gcloud config set project YOUR_PROJECT_ID

    Step 2: Stop the Instance (Recommended)

    For data consistency, stop the instance before creating a snapshot:

    # List your instances
    gcloud compute instances list
    
    # Stop the instance
    gcloud compute instances stop INSTANCE_NAME --zone=ZONE

    Step 3: Create a Snapshot

    Create a snapshot of the boot disk:

    # List disks to find your boot disk
    gcloud compute disks list
    
    # Create a snapshot
    gcloud compute snapshots create my-migration-snapshot \
      --source-disk=DISK_NAME \
      --source-disk-zone=ZONE \
      --storage-location=us

    Step 4: Create a Disk from Snapshot

    Create a new disk from the snapshot for export:

    gcloud compute disks create migration-export-disk \
      --source-snapshot=my-migration-snapshot \
      --zone=ZONE

    Step 5: Create Cloud Storage Bucket

    Create a bucket for the exported image:

    # Create a bucket (bucket names must be globally unique)
    gsutil mb -l us gs://my-migration-bucket-12345
    
    # Grant the Compute Engine service account access
    gsutil iam ch serviceAccount:PROJECT_NUMBER-compute@developer.gserviceaccount.com:objectAdmin gs://my-migration-bucket-12345

    Step 6: Export the Disk Image

    Export the disk to Cloud Storage in a portable format:

    # Export as RAW format (recommended for conversion to QCOW2)
    gcloud compute images export \
      --destination-uri=gs://my-migration-bucket-12345/disk-image.tar.gz \
      --source-disk=migration-export-disk \
      --source-disk-zone=ZONE \
      --export-format=raw
    
    # Alternative: Export as VMDK
    gcloud compute images export \
      --destination-uri=gs://my-migration-bucket-12345/disk-image.vmdk \
      --source-disk=migration-export-disk \
      --source-disk-zone=ZONE \
      --export-format=vmdk

    Note: The export process may take 15-60 minutes depending on disk size. You can monitor progress in the Cloud Console under Compute Engine → Operations.

    Step 7: Download the Image

    Download the exported image to your local machine or a transfer server:

    # Download from Cloud Storage
    gsutil cp gs://my-migration-bucket-12345/disk-image.tar.gz .
    
    # Extract the raw image
    tar -xzf disk-image.tar.gz
    # This creates a file named 'disk.raw'

    Step 8: Convert to QCOW2

    Convert the raw image to QCOW2 format for efficient upload:

    # Install qemu-utils if needed
    sudo apt-get install -y qemu-utils
    
    # Convert to QCOW2 with compression
    qemu-img convert -f raw -O qcow2 -c disk.raw gcp-server.qcow2
    
    # Verify the image
    qemu-img info gcp-server.qcow2

    Step 9: Clean Up GCP Resources

    After successful migration, clean up temporary resources to avoid charges:

    # Delete the export disk
    gcloud compute disks delete migration-export-disk --zone=ZONE
    
    # Delete the snapshot (optional, keep for rollback)
    gcloud compute snapshots delete my-migration-snapshot
    
    # Delete the Cloud Storage object (after uploading to RamNode)
    gsutil rm gs://my-migration-bucket-12345/disk-image.tar.gz

    2Live System with rsync

    For simpler setups or application-level migrations, you can use rsync to transfer files directly to a new RamNode instance. This is ideal when you want a fresh OS installation.

    Step 1: Deploy RamNode Instance

    Create a new VPS on RamNode with the same operating system as your GCP instance. Choose a plan with at least the same resources.

    Step 2: Set Up SSH Key Authentication

    On your GCP instance, set up SSH key access to the RamNode server:

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

    Step 3: Sync Files with rsync

    Execute rsync from your GCP instance 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/*' \
      --exclude='/var/lib/google/*' \
      --exclude='/etc/google_hostname' \
      / root@RAMNODE_IP:/

    Tip: Run rsync multiple times for minimal downtime. The first run copies everything; subsequent runs only sync changes.

    Step 4: Remove GCP-Specific Packages

    On the RamNode server, remove GCP-specific packages:

    # Ubuntu/Debian
    apt-get purge google-cloud-sdk google-compute-engine \
      google-compute-engine-oslogin google-osconfig-agent
    apt-get autoremove
    
    # CentOS/Rocky/Alma
    yum remove google-cloud-sdk google-compute-engine \
      google-compute-engine-oslogin google-osconfig-agent

    Step 5: Update System Configuration

    Update critical configuration files:

    # Update hostname
    hostnamectl set-hostname your-new-hostname
    
    # Reset machine-id for cloud-init
    rm /etc/machine-id
    systemd-machine-id-setup
    
    # Remove GCP-specific configs
    rm -rf /etc/google_hostname
    rm -rf /var/lib/google/*
    
    # Update network configuration (Ubuntu with Netplan)
    nano /etc/netplan/50-cloud-init.yaml
    netplan apply

    Step 6: 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 File as the source and upload your QCOW2 file
    5. Configure image details:
      • Name: Descriptive name (e.g., "gcp-webserver-ubuntu22")
      • Format: Select QCOW2
      • Minimum disk size: Match or exceed your original GCP 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 gcp-server.qcow2 \
      "gcp-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 GCP instance
    4. Select your preferred datacenter location
    5. Configure networking, SSH keys, and other options
    6. Click Create Instance
    GCP Machine TypeSpecsRamNode Equivalent
    e2-micro0.25-2 vCPU, 1 GB RAMCloud VPS 1GB+
    e2-small0.5-2 vCPU, 2 GB RAMCloud VPS 2GB+
    e2-medium1-2 vCPU, 4 GB RAMCloud VPS 4GB+
    e2-standard-22 vCPU, 8 GB RAMCloud VPS 8GB+
    e2-standard-44 vCPU, 16 GB RAMCloud VPS 16GB+
    e2-standard-88 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, especially related to disk or network drivers.

    Remove GCP Guest Environment

    If you used the disk export method, remove GCP-specific components:

    # Ubuntu/Debian
    apt-get purge google-cloud-sdk google-compute-engine \
      google-compute-engine-oslogin google-osconfig-agent gce-disk-expand
    apt-get autoremove
    
    # Remove GCP metadata scripts
    rm -rf /etc/google_hostname
    rm -rf /var/lib/google/*
    rm -rf /usr/share/google/*

    Network Configuration

    Reconfigure networking for RamNode's infrastructure:

    • Remove GCP-specific network configurations
    • Configure DHCP on primary network interface
    • Update DNS resolver settings if hardcoded
    # Reset cloud-init to use RamNode's metadata
    cloud-init clean --logs
    rm -rf /var/lib/cloud/*
    
    # Reboot to reinitialize
    reboot

    Update DNS Records

    Update your DNS records to point to the new RamNode IP address. If you use Google Cloud DNS, remember to update records there as well or migrate to another DNS provider.

    Verify Services

    Test all critical services to ensure they function correctly:

    • Web servers (Apache, Nginx)
    • Database services (MySQL, PostgreSQL, Cloud SQL proxies need reconfiguration)
    • Application services
    • SSL/TLS certificates
    • Cron jobs and scheduled tasks
    • GCP service account credentials (update if applications use GCP services)

    Troubleshooting

    Instance Won't Boot

    • Verify virtio drivers are installed (GCP uses virtio, so this is usually fine)
    • Check GRUB configuration for correct disk references
    • Verify the image isn't corrupted (compare checksums)
    • Ensure disk size meets minimum requirements
    • Check /etc/fstab for GCP-specific disk UUIDs or labels

    Network Not Working

    • Check for interface name changes (eth0 vs ens4)
    • Remove GCP metadata-based network configuration
    • Configure DHCP on the primary network interface
    • Verify cloud-init is properly reconfigured
    • Check for static routes that reference GCP internal networks

    SSH Access Issues

    • GCP OS Login may interfere - disable it: apt-get purge google-compute-engine-oslogin
    • Verify SSH daemon is running and configured correctly
    • Check authorized_keys for proper key entries
    • Use VNC console to access the system if SSH fails

    Application Issues

    • Applications using GCP metadata service will fail - update configurations
    • Cloud SQL Proxy connections need database migration or alternative setup
    • Service account credentials may need updating for GCP API access
    • Load balancer configurations won't transfer - set up manually

    Best Practices

    PracticeRecommendation
    Create Snapshots FirstAlways snapshot your GCP instance before migration
    Document GCP ServicesList all GCP-specific services your app uses (Cloud SQL, Pub/Sub, etc.)
    Clean Before ExportRemove logs, temp files, and package caches to reduce image size
    Use QCOW2 FormatConvert RAW exports to QCOW2 for efficient storage and upload
    Test ThoroughlyDeploy and test on RamNode while keeping GCP running
    Lower DNS TTLReduce TTL days before migration for faster DNS propagation
    Plan for GCP CleanupDelete GCP resources after successful migration to avoid ongoing charges

    Need Professional Assistance?

    Our Professional Services team can help with complex migrations from GCP, including database migrations and application reconfiguration.

    Related Documentation