Create
Create a New Block Storage Volume
To create a new volume, send a POST request to /v2/volumes
. Optionally, a filesystem_type
attribute may be provided in order to automatically format the volume's filesystem. Pre-formatted volumes are automatically mounted when attached to Ubuntu, Debian, Fedora, Fedora Atomic, and CentOS Droplets created on or after April 26, 2018. Attaching pre-formatted volumes to Droplets without support for auto-mounting is not recommended.
Parameters
A human-readable name for the block storage volume. Must be lowercase and be composed only of numbers, letters and "-", up to a limit of 64 characters. The name must begin with a letter.
The slug identifier for the region where the resource will initially be available.
The size of the block storage volume in GiB (1024^3). This field does not apply when creating a volume from a snapshot.
An optional free-form text field to describe a block storage volume.
The label applied to the filesystem. Labels for ext4 type filesystems may contain 16 characters while labels for xfs type filesystems are limited to 12 characters. May only be used in conjunction with filesystem_type.
The name of the filesystem type to be used on the volume. When provided, the volume will automatically be formatted to the specified filesystem type. Currently, the available options are ext4
and xfs
. Pre-formatted volumes are automatically mounted when attached to Ubuntu, Debian, Fedora, Fedora Atomic, and CentOS Droplets created on or after April 26, 2018. Attaching pre-formatted volumes to other Droplets is not recommended.
The unique identifier for the volume snapshot from which to create the volume.
Returns
from do_gradientai import GradientAI
client = GradientAI()
volume = client.gpu_droplets.volumes.create(
name="ext4-example",
region="nyc1",
size_gigabytes=10,
description="Block store for examples",
filesystem_label="ext4_volume_01",
filesystem_type="ext4",
)
print(volume.volume)
{
"volume": {
"description": "Block store for examples",
"filesystem_label": "example",
"filesystem_type": "ext4",
"name": "example",
"size_gigabytes": 10,
"tags": [
"base-image",
"prod"
]
}
}