Create a standalone volume when you need a disk that isn’t tied to one instance’s lifetime. You can create an empty volume of a given size, or a volume that starts with the data of a snapshot.
Before you begin
Create an empty volume
-
Optional: list the storage classes and pick one whose
availableistrue. Omit the class to get the default,gp1. See Storage classes.terminal origin storage list-storage-classes -
Create the volume.
--sizeis in GiB and defaults to 8.terminal origin storage create-volume --project-urn <project-urn> \ --size 100 --storage-class gp1With the API, use the
createVolumemutation:GraphQL mutation { pvs { createVolume(input: { projectUrn: "<project-urn>" sizeInGib: 100 storageClass: "gp1" }) { urn status } } }The new volume reports
CREATING. Note itsurn. -
Check the volume’s status until it reports
AVAILABLE.terminal origin storage get-volume --volume-urn <volume-urn>
Create a volume from a snapshot
A volume created from a snapshot starts with the data the snapshot captured. The snapshot must belong to the project you create the volume in. A snapshot in another project is refused as not found, even within the same organization.
The platform checks three more rules before it creates anything:
- The snapshot reports
status: COMPLETED. - The snapshot reports
protectionStatus: PROTECTED. - The size you ask for is at least the size of the volume the snapshot was taken from, shown as the snapshot’s
volumeSizeInGib. A larger size gives you the extra space.
If a rule doesn’t hold, the request is refused with an error that names the rule. Nothing is created.
-
Check the snapshot’s
status,protectionStatus, andvolumeSizeInGib.terminal origin storage get-snapshot --snapshot-urn <snapshot-urn> -
Create the volume, passing a size of at least
volumeSizeInGib. In the CLI, always pass--size: its default of 8 GiB is refused for a snapshot of a larger volume.terminal origin storage create-volume --project-urn <project-urn> \ --snapshot-urn <snapshot-urn> --size 100With the API, add
snapshotUrnto thecreateVolumeinput. -
Check the volume’s status until it reports
AVAILABLE.terminal origin storage get-volume --volume-urn <volume-urn>
If this fails
If the volume reports ERROR instead of AVAILABLE, its creation failed and statusReason says why. Delete it and create a new one. For refused requests, such as PRODUCT_UNAVAILABLE or a quota error, see Troubleshoot storage.
Next steps
- Attach and detach volumes – connect the volume to an instance, running or stopped.
- Create and protect a snapshot