Upload an image

Here we cover how to create a custom image by uploading a properly-formatted .img file for use as a custom image.

👍

This is intended for advanced system administrators. In most cases, you might be better suited capturing an image directly from an existing compute instance, or through our Packer Builder tool. Both of these methods ensure maximum compatibility with our services and are easier to follow.

Requirements and considerations

Before you create a custom image for upload, consider these points:

  • Use a raw disk image. Your image file needs to be in raw disk image format (.img). Other file formats aren't supported.

  • Compress the disk file. You need to compress your image file using gzip (.gz) before you upload it. Other compression algorithms aren't compatible. Maximum file sizes apply:

    • The maximum compressed file size is 5 GB.
    • The maximum uncompressed image file size is 6 GB*.
  • Format the disk using the ext3 or ext4 file system. If you have a raw disk, or you've formatted your disk using another file system, it's not compatible.

📘

As a best practice, ensure that your disk is not partitioned. You can use partitioned disks, but some manual configuration may be required. You can also use our Network Helper tool which is most compatible with non-partitioned image files.

  • Account limits. Your account can store up to 25* custom images, offering 150 GB* of combined storage for all images.

  • Pricing. Custom images are billed monthly at $0.10 per GB, based on the uncompressed image size."

* If you need to store larger images or more images, contact Linode Support with details on your applications or intended workloads.

Set up an image file

Here are a few methods to get you started. Depending on how you obtain or generate it, the image or image file may need further configuration so it can be used with our Image Upload feature.

  • Existing Image. Use a compatible image from your own on-premise environment, existing cloud provider, or through an online repository , such as a distribution's official image repository.

  • Packer. Use Packer's QEMU Builder to automate the creation of a custom image. In the .json configuration file for your image, set "accelerator": "kvm" and "format": "raw". If running Packer inside of a virtual machine, the hypervisor needs to support nested virtualization.

  • The dd utility. Install and configure an operating system on a local, remote, or virtualized system and create a disk image using the dd command-line tool.

  • The QEMU disk image utility. Use the QEMU disk image utility to create the image.

Compress the image file

Once you have your image file, you need to compress it using gzip.

Determine uncompressed file size

When you're planning the storage requirements for a compute instance, it's helpful to know the uncompressed size of an image file. This also helps you stay within the limits of the images service. The best way to determine the uncompressed size of a gzip archive is to uncompress that archive and then examine its file size. Alternatively, use the zcat utility by running the following command, replacing [file.img.gz] with the file name of your image:

zcat [file.img.gz] | wc -c

Upload an image file

You have multiple options when uploading an image file.

Use Cloud Manager

Once you have a compatible image file that meets all the requirements, upload it through the Upload Image Cloud Manager form. After it's uploaded, you can deploy compute instances using the image.

  1. Log in to Cloud Manager.

  2. Select Images and click Create Image.

  3. Select the Upload Image tab. Set these options:

    • Label. Enter an easy-to-recognize name for the image. If you leave this blank, Cloud Manager uses the label set for the disk.

    • This image is cloud-init compatible. Enable this only if your image is compatible with cloud-init, or has cloud-init installed, and the config has been changed to use our Metadata service.

    • Region. Select the core compute region where you want the image to be stored. As a best practice, select the region that's closest to you for the fastest upload. For more information on regions, see Regions and images.

    • Add Tags. Optionally enter a tag to group similar objects under a specific value. Once you set one, you can select it again with other images.

    • Description. Optionally add some text to describe your image.

  4. Select a compatible image file you want to use. Either drag and drop it into the designated area or click Browse Files to navigate your local system. The filename appears along with a progress bar for the file upload.

Finish a Cloud Manager upload

After upload, Cloud Manager creates a custom image and redirects you to the main Images page. You should see it listed along with a status of Pending Upload. Once it's ready, Cloud Manager changes its status to Ready.

📘

If an error occurs, Cloud Manager may delete the image and write a message to your events log. See Events and activity feeds for more details on viewing Cloud Manager events.

Use the Linode CLI

You can also upload an image file using the Linode CLI.

  1. Run this command to install or update the Linode CLI:

    pip3 install linode-cli --upgrade
    
  2. If this is your first time using the CLI or if you encounter any authorization issues, reconfigure and authorize your installation:

    linode-cli configure
    
  3. Create a custom image and upload a compatible image file using the following command:

    linode-cli image-upload --label "[Label]" [File] --region "[region-id]" --description "[Description]"
    
    • [Label]. Replace this with a unique name for the image.

    • [File]. Replace this with the filename and path of the image file you want to use.

    • [region-id] (Optional). Replace this with the id of the compute region where you want to store the image. If you leave this is out, the CLI uses the default region you specified when you configured it.

    • [Description] (Optional). Replace this with some text to describe your image.

Example upload command

Here's an example of the command for a custom image created in the Newark data center with the label "Example Image," a description of "Some details about the image," and the image file "~/Downloads/image-file.img.gz" will be uploaded.

linode-cli image-upload --label "Example Image" --description "Some details about the image" --region "us-east" ~/Downloads/image-file.img.gz

Finish a CLI upload

After you issue the command, the CLI displays a progress bar for the file upload. On completion, the CLI displays a single data row table with details on the new custom image with a status of pending_upload.

The image upload may take a few minutes to fully process. To verify it's available for use, run this command and look for a status of available for the custom image:

linode-cli images list --is_public false