Import a disk image when you’ve built one yourself and want it as a volume’s initial content. The platform downloads the image from an HTTP(S) URL, converts it to raw format, and writes it into a new volume. To launch instances from the result, snapshot and protect the volume, then create an image from the snapshot.
Before you begin
Choose the image and size
The platform detects the image format and converts it. Common disk image formats are accepted, including qcow2 (also compressed qcow2) and raw. Host the image file itself, not an archive of it such as .gz or .xz.
sizeInGib is the size of the volume you get. It’s what the disk becomes, what counts against your quota, and what you’re billed for:
- An image whose virtual size is smaller than
sizeInGibleaves you the extra space. - An image whose virtual size is larger than
sizeInGibis refused. The import fails and the volume ends inERROR, because the platform can’t shrink your image without destroying part of it.
Import the image
-
Start the import with a size of at least the image’s virtual size.
terminal origin storage import-volume --project-urn <project-urn> \ --size-in-gib 20 \ --source-url https://example.com/images/my-image.qcow2With the API, use the
importVolumemutation:GraphQL mutation { pvs { importVolume(input: { projectUrn: "<project-urn>" sizeInGib: 20 sourceUrl: "https://example.com/images/my-image.qcow2" }) { urn status } } }Add
--storage-classorstorageClassto choose a class other than the default. See Storage classes. -
Check the volume’s status until it leaves
CREATING.terminal origin storage get-volume --volume-urn <volume-urn>AVAILABLEmeans the import succeeded and the volume holds your image.
Time limits
An import must finish within 25 minutes, including downloading, converting, and writing the image. The import fails with ERR_IMPORT when:
- it takes longer than 25 minutes, for example a very large image or a slow source,
- the source answers with an HTTP error status,
- the source sends no data for 60 seconds.
If the import fails
A failed import leaves the volume in ERROR, and statusReason names the cause:
statusReason | Cause and fix |
|---|---|
the operation failed (ERR_IMPORT_IMAGE_TOO_LARGE) | The image’s virtual size is larger than sizeInGib. Delete the volume and import again with a larger size. |
the operation failed (ERR_IMPORT) | The download, conversion, or write failed, or the import ran out of time. Delete the volume and import again, from a faster source if time was the problem. |
No data from a failed import is kept, but the ERROR volume counts against your quota until you delete it. See Delete a volume.