Skip to main content

Migrate a virtual machine from another provider's VMware cloud to a Selectel cloud server

You can transfer data to a cloud server: export VMs from vCloud Director, vSphere, and ESXi and create a cloud server in Selectel.

If you want to stay on VMware and migrate to the VMware-based Cloud in Selectel, choose a migration method.

How migration works

A VM is exported from VMware in OVF format along with its disks, verified using checksums, uploaded to Selectel S3, and imported as an image. Most vCloud sites provide API access—most operations are performed from the console and automated. A VM here refers to the entire vApp: all VMs included in it are exported.

A running VM cannot be exported, so OVF Tool powers it down before exporting. Agree on a maintenance window for each VM in advance.

Transfer data to a cloud server

  1. Prepare for migration.
  2. For Windows VMs, install virtio drivers.
  3. Export the VM to OVF format.
  4. Verify files and upload them to S3.
  5. Create a cloud server from the image.

1. Prepare for migration

  1. Obtain access to the virtual data center (vDC) with Organization Administrator permissions from your VMware provider.

  2. From the Broadcom website (VMware), download VMware OVF Tool and extract it to a computer or VM with sufficient space for disk images.

  3. Create a bucket in Selectel S3.

  4. Create a service user with access to S3.

  5. Issue an S3 key to the user.

  6. Configure Rclone to work with the bucket:

    [selectel]
    type = s3
    provider = Other
    access_key_id = <access_key>
    secret_access_key = <secret_key>
    endpoint = <s3_domain>
    region = <pool>

    Specify:

    • <access_key> — Access key field value from the S3 key issued in step 5;
    • <secret_key> — Secret key field value from the S3 key issued in step 5;
    • <pool> — pool where you created the bucket in step 3;
    • <s3_domain> — S3 API domain. The domain depends on the pool where the bucket was created.

2. Prepare the Windows VM

For Windows to start on the cloud server, virtio drivers must be installed on the source VM before exporting the system disk image. Before mass migration, verify the procedure on a single non-critical Windows VM.

  1. Download the ISO image with drivers: virtio-win.iso.
  2. Mount the image in the source OS.
  3. Install all drivers.
  4. Reboot the server during the agreed maintenance window.

3. Export the VM

If you have:

Single VM

Run the export:

./ovftool --powerOffSource \
--X:logFile=<ovftool_path>.log --X:logLevel=<log_level> \
--parallelThreads=4 --X:progressSmoothing=10 \
--X:vCloudTimeout=60000 --X:vCloudKeepAliveTimeout=60000 \
"vcloud://<username>:<password>@<provider_address>?org=<org_name>&vdc=<vdc_name>&vapp=<vapp_name>" \
"<vapp_path>.ovf"

Specify:

  • <ovftool_path> — path to the OVF Tool log without the .log extension;
  • <log_level> — logging level. Possible values: none, quiet, panic, error, warning, info, verbose, trivia;
  • <username> — vCloud Director username;
  • <password> — vCloud Director user password. URL-encode special characters in the password: for example, @ is written as %40;
  • <provider_address> — vCloud Director address of your VMware provider site;
  • <org_name> — organization name;
  • <vdc_name> — virtual data center (vDC) name;
  • <vapp_path> — path to the vApp.

Where:

  • --powerOffSource — power off the VM before exporting;
  • --parallelThreads — number of threads, from 1 to 100, but no more than the number of CPU cores minus one;
  • --X:progressSmoothing — upload time estimation smoothing interval in seconds (default is 60);
  • --X:vCloudTimeout — how long to wait for a vCloud response during export preparation. Important for large VMs;
  • --X:vCloudKeepAliveTimeout — how long to keep the connection to vCloud open. Important for large VMs.

Parameters like --X:... and --parallelThreads are specified before the vCloud Director address.

As a result of the export, the following files will appear in the directory:

  • .mf — SHA-256 checksums of the VM files calculated on the VMware side;
  • .ovf — VM description in Open Virtualization Format;
  • .nvram — BIOS/UEFI settings;
  • .vmdk — disk images. They are smaller than disks in vCloud Director because compression is used during export.

Multiple VMs

  1. In the vmlist file, list the vApp names, one per line.

  2. In the folder containing the ovftool file, add a script:

    #!/usr/bin/env bash
    # export-vapps.sh - parallel export of vApps from vCloud Director
    set -euo pipefail

    export OVFTOOL=./ovftool
    export VCD_HOST="<provider_address>"
    export ORG="<org_name>"
    export VDC="<vdc_name>"
    export VCD_USER="<username>"
    export OUT_DIR=./export
    NJOBS=<vapp_amount>

    read -rsp "vCloud password (special characters URL-encoded): " VCD_PASS; echo
    export VCD_PASS
    mkdir -p "$OUT_DIR"

    export_vapp() {
    local vapp="$1"
    mkdir -p "$OUT_DIR/$vapp"
    "$OVFTOOL" --powerOffSource \
    --X:logFile="$OUT_DIR/$vapp/ovftool.log" --X:logLevel=verbose \
    --parallelThreads=4 --X:vCloudTimeout=60000 --X:vCloudKeepAliveTimeout=60000 \
    "vcloud://${VCD_USER}:${VCD_PASS}@${VCD_HOST}?org=${ORG}&vdc=${VDC}&vapp=${vapp}" \
    "$OUT_DIR/$vapp/$vapp.ovf" && echo "OK $vapp" || echo "ERR $vapp"
    }
    export -f export_vapp

    grep -v '^[[:space:]]*$' vmlist | xargs -P "$NJOBS" -I{} bash -c 'export_vapp "$1"' _ {}

    Specify:

    • <provider_address> — vCloud Director address of your VMware provider site;
    • <org_name> — organization name;
    • <vdc_name> — virtual data center (vDC) name;
    • <username> — vCloud Director username;
    • <vapp_amount> — number of vApps to be exported concurrently.

    Where:

    • --powerOffSource — power off the VM before exporting;
    • --parallelThreads — number of threads, from 1 to 100, but no more than the number of CPU cores minus one;
    • --X:vCloudTimeout — how long to wait for a vCloud response during export preparation. Important for large VMs;
    • --X:vCloudKeepAliveTimeout — how long to keep the connection to vCloud open. Important for large VMs.
  3. Run the script. The script will prompt for the vCloud password.

  4. Enter the vCloud password. URL-encode special characters in the password: for example, @ is written as %40.

4. Verify and upload to S3

Verify the checksums of the downloaded files against .mf using a script. For very large files uploaded to storage in parts, there might not be a total checksum—in that case, rclone check compares only the size. Data integrity itself is guaranteed in any case by the SHA-256 check before upload.

The script will check each VM, upload verified files to S3, verify uploaded data against local data, and move processed directories to ./export/processed:

#!/usr/bin/env bash
# check-and-upload.sh - SHA-256 verification against .mf and upload to storage
set -euo pipefail

EXPORT_DIR="<export_dir>"
REMOTE="<remote>:<bucket_name>"
mkdir -p "$EXPORT_DIR/processed"

mapfile -t manifests < <(find "$EXPORT_DIR" -name '*.mf' -not -path '*/processed/*')

for mf in "${manifests[@]}"; do
dir=$(dirname "$mf"); vapp=$(basename "$dir"); ok=1
while IFS= read -r line; do
file=$(sed -E 's/^SHA256\((.*)\)= .*/\1/' <<<"$line")
expected=$(sed -E 's/^.*= //' <<<"$line")
actual=$(sha256sum "$dir/$file" | awk '{print $1}')
if [[ "$actual" == "$expected" ]]; then echo "OK $vapp/$file"
else echo "ERR $vapp/$file - checksum mismatch"; ok=0; fi
done < <(grep '^SHA256' "$mf")

if [[ $ok -eq 1 ]]; then
rclone copy "$dir" "$REMOTE/$vapp" --progress --transfers 4
rclone check "$dir" "$REMOTE/$vapp" --one-way && mv "$dir" "$EXPORT_DIR/processed/"
else
echo "vApp $vapp: repeat the export"
fi
done

Specify:

  • <export_dir> — directory with export results;
  • <remote> — Rclone connection name. Must match the name from the Rclone configuration file that you added during migration preparation in step 1, step 6;
  • <bucket_name> — name of the bucket for uploading images that you created during migration preparation in step 1, step 3.

If export fails with an error

During export, vCloud first saves the VM image locally. If the provider lacks space on the virtualization host for VMs with large disks, the job may fail. In that case, disks can be exported over the network using dd.

For more details on bit-by-bit copying, including how to resume an interrupted transfer, see the Transfer Linux server data to a Selectel cloud server using dd instructions.

  1. Boot the VM from a rescue image, such as Selectel Rescue.

  2. Copy the disk to the receiving server:

    dd if=/dev/sda bs=32M status=progress | pv -qL 90M | ssh root@<receiver_ip> "dd of=/data/<vm_name>.raw bs=32M"

    Specify:

    • <receiver_ip> — IP address of the receiving server;
    • <vm_name> — VM name used for the image file name on the receiving server.

    Where:

    • bs=32M — block size, practically optimal for speed;
    • pv -qL 90M — 90 MB/s bandwidth limit to leave bandwidth for other VMs. On the receiving side, you can write directly to a disk instead of a file, for example of=/dev/sda.
  3. On the source VM, calculate the checksum of the disk. Use SHA-256 instead of MD5:

    sha256sum <source_disk>

    Specify <source_disk> — path to the source disk, for example /dev/sda.

  4. On the receiving server, calculate the checksum of the image:

    sha256sum <file_path>

    Specify <file_path> — path to the received image that you specified in step 2, for example /data/<vm_name>.raw.

  5. Compare the checksum values from steps 3 and 4. If the checksums match, the data has been transferred without loss.

5. Create a cloud server from the image

Modern Linux distributions include virtio drivers and cloud-init, so such VMs usually import and start without modifications. For full compatibility, follow the recommendations for importing images.

  1. Upload the disk image in the Control panel under Images. Images larger than 100 GB are more convenient to upload via OpenStack CLI:

    openstack image create --disk-format vmdk --container-format bare \
    --file <vm_name>-disk1.vmdk <vm_name>

    Specify:

    • <vm_name>-disk1.vmdk — path to the exported VM disk file;
    • <vm_name> — image name that will be displayed in the Control panel.
  2. Create a cloud server from the image.

  3. Verify that the services are working.

Migrating to VMware-based Cloud in Selectel

If you want to stay on VMware, the migration method to VMware-based Cloud in Selectel depends on where your infrastructure is currently located:

Current locationMigration method
On-premises VMware site with vCenterVMware Cloud Director Availability
On-premises VMware site without vCenter (e.g., free ESXi)VMware Cloud Director Availability, if you deploy a trial version of vCenter
On-premises site on Hyper-V, Proxmox, and other platformsVeeam Agent
Another provider's VMware cloudVeeam Agent
VMware cloud in Selectel, changing cluster or regionVMware Cloud Director Availability
VMware cloud in Selectel, changing legal entityTo transfer an organization without downtime, submit a ticket
Dedicated servers or Selectel cloud serversVeeam Agent