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
- The URN of the project to create the volume in.
- Permission
pvs.volume.createon the project. See Roles. - An active organization. See Review your organization’s status.
- A billing account that can pay. For card-managed billing, that means a verified payment method. See Add a payment method.
- Enough volume storage quota for the full size of the new volume. See Limits.
- To create from a snapshot: a snapshot in the same project that reports
status: COMPLETEDandprotectionStatus: PROTECTED. See Create and protect a snapshot.
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 window origin storage list-storage-classes -
Create the volume.
--sizeis in GiB and defaults to 8.Terminal window origin storage create-volume --project-urn <project-urn> \--size 100 --storage-class gp1With the API, use the
createVolumemutation:mutation {pvs {createVolume(input: {projectUrn: "<project-urn>"sizeInGib: 100storageClass: "gp1"}) {urnstatus}}}The new volume reports
CREATING. Note itsurn. -
Check the volume’s status until it reports
AVAILABLE.Terminal window 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 window 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 window 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 window 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