Article

Table of Contents
Theme:
Was this article helpful?

1  out of  1 found this helpful

Try Vultr Today with

$50 Free on Us!

Want to contribute?

You could earn up to $300 by adding new articles!

Import a Server to Vultr VPS

Last Updated: Wed, May 19, 2021
Linux Guides System Admin Windows Guides

Introduction

This guide describes, in general terms, the steps to import a server to Vultr. The exact procedure for each OS distribution and virtualization platform varies. Where possible, we've included links to further documentation. Please research the provided links for your configuration before beginning a migration. Please note that Vultr is responsible for the platform infrastructure, but not the administration of VPS instances. You are responsible for the administration of the VPS deployments on your account. If you have difficulties performing a task in your account portal, please open a support ticket.

Import Requirements

Before migrating your server, ensure it meets the Vultr requirements:

  • The server architecture must be x86-64/x64/amd64
  • The server must use legacy BIOS (not UEFI) boot. Do not create a UEFI system partition.
  • The server has an appropriate boot loader installed.
  • The disk must be 150 GB or smaller.
  • The server must have the appropriate VirtIO drivers installed and loaded.

Make sure your workstation has enough free disk space to convert the disk images into raw format before uploading it to Vultr.

1. Make a Backup

Before performing any operations on your existing server, make a full backup and know how to restore it.

2. Clean up the Server

This step is optional but highly recommended. Before creating the raw image, clean up the server as much as possible. Remove old logs, temporary files, etc. to free up disk space. Overwrite free disk sectors with zeros to improve compression and wipe recently-deleted data for security. Two standard utilities to wipe free disk space are zerofree and dd.

Zerofree is the best choice if it is available for your distribution. See the full documentation. Zerofree is also available on the SystemRescueCD live ISO. Example:

# zerofree -v /dev/sda2

If zerofree is not available, use dd. This example creates a temporary file with zeros to fill the disk, then deletes the file.

# dd if=/dev/zero of=/tmpfile bs=4096k; rm -f /tmpfile 

For Windows servers, use the sdelete utility. The -z option will fille the empty space with zero bytes. Download sdelete from the Windows Sysinternals site. Open an administrative command prompt, and run sdelete on the desired volume.

C:\> sdelete -z c:

3. Export the Server Image File

The server capture process varies depending on the source platform. Here are the most common export steps with links to relevant documentation.

Export an On-Premise Virtual Server

If you have enough disk space available and can do the conversion directly on the host machine, you may skip this step. If you need to perform image conversion on a different computer or upload it from a different location, you may want to export your server to external media. Here are instructions for several popular systems.

Export a Physical Server

The dd utility is a popular way to capture a raw disk image. The source disk should be dismounted before imaging. One common technique is to temporarily boot the server using the SystemRescueCD live ISO. You will need to mount a storage location to save the raw image.

Assuming the server data device is /dev/sda and the image will be written to /mnt/usb_external/server_image.img, use the following command from a root terminal.

# dd if=/dev/sda bs=1M of=/mnt/USB_external/server_image.img

Two popular options for Windows imaging are ntfsclone, and disk2vhd. The SystemRescueCD live ISO includes ntfsclone, and the full documentation is available online. Disk2vhd from Microsoft Sysinternals can capture a live running system. It can also save the resulting image directly on the server, if enough free space is available.

4. (Optional) Test with QEMU

Vultr VPS images are compatible with QEMU. To verify the VirtIO drivers are installed properly, launch the server in QEMU on your local system before uploading it to Vultr. QEMU is available for all platforms.

5. Convert to Raw Format

Vultr requires snapshots in raw image format. If you created a raw image with dd, no conversion is necessary. If your exported image is not in raw format, use the free utilities from QEMU or VirtualBox. Versions are available for Linux, Windows, and macOS.

QEMU

QEMU supplies the qemu-img utility, which converts many formats including:

  • QCOW2 (KVM, Xen)
  • QED (KVM)
  • VDI (VirtualBox)
  • VHD (Hyper-V)
  • VMDK (VMware)

Example:

$ qemu-img convert -f vmdk -O raw image.vmdk image.img

VirtualBox

VirtualBox supplies the VBoxManage utility to convert:

  • VDI (VirtualBox)
  • VMDK (VMWare)
  • VHD (Hyper-V)

Example:

$ VBoxManage clonemedium disk /path/to/image.vdi image.img --format raw

6. Stage the Image for Upload to Vultr

To add the snapshot to your Vultr account, stage the image at any publicly-accessible URL. Some suggested options are:

  • Vultr Object Storage
  • A Vultr Cloud Server (for optional compression)
  • Dropbox
  • Google Cloud Storage (not Google Drive).

(Optional) Use a Temporary Vultr Cloud Server for Compression

On a slow internet connection, you can temporary deploy a Vultr One-Click LAMP app as a staging location. Then, use scp or rsync to compress the upload stream and dramatically improve the upload speed.

  1. Deploy a Vultr One-Click LAMP app with an SSD large enough to hold the uncompressed image.
  2. Upload the RAW image with compression. These examples use 192.0.2.123 as the One-Click LAMP IP address:

    Option 1: Use scp.
    From a terminal (or PowerShell on Windows) on your local workstation, use scp with the -C parameter for compression.

    $ scp -C image.img root@192.0.2.123:/var/www/html/image.img
    

    Option 2: Use rsync.
    If rsync is available on your workstation, it is faster than scp in most cases.

    $ rsync -z --progress image.img root@192.0.2.123:/var/www/html/image.img
    
  3. After the transfer completes, use the public URL of the One-Click LAMP server to add the image as a Vultr Snapshot.

    http://192.0.2.123/image.img
    

7. Add the Image as a Vultr Snapshot

Navigate to Products > Snapshots > Add Snapshot in your customer portal.

AddSnapshot

Enter the URL of your image and click Upload.

8. Deploy Server from Snapshot

Restore the server snapshot, following the steps from the VPS Snapshots Quickstart Guide. Make sure the VPS SSD is the same size, or larger, than the server snapshot.

9. Expand the Filesystem (if needed)

Log into your newly-deployed server. Verify that the disk, partition, and filesystem sizes are correct.

  • Verify the disk size: fdisk -l
  • Verify the partition size: parted -l
  • Check the filesystem size: df -h

If needed, use resize2fs to expand the filesystem to the full partition size. Substitute vda1 with your device name.

$ sudo resize2fs /dev/vda1

Other Resources

Here are links to useful resources when migrating to a new Vultr VPS.

Want to contribute?

You could earn up to $300 by adding new articles