Linode Instances

List Disks

get
https://api.linode.com/v4/linode/instances/{linodeId}/disks

View Disk information for Disks associated with this Linode.

Authorizations

Personal Access Token
OAuth: ( linodes:read_only)

Path Parameters

linodeId
Required
integer

ID of the Linode to look up.

Query Parameters

page
integer > = 1
Default: 1

The page of a collection to return.

page_size
integer [25 .. 100]
Default: 100

The number of items to return per page.

Request Samples

curl -H "Authorization: Bearer $TOKEN" \
    https://api.linode.com/v4/linode/instances/123/disks

Response Samples

{
  "data": [
    {
      "id": "",
      "created": "2018-01-01T00:01:01",
      "status": "ready",
      "label": "Debian 9 Disk",
      "size": 48640,
      "updated": "2018-01-01T00:01:01",
      "filesystem": "ext4"
    }
  ],
  "page": 1,
  "pages": 1,
  "results": 1
}

Responses

200: Returns a paginated list of disks associated with this Linode.

data
array of objects
id
integer

This Disk's ID which must be provided for all operations impacting this Disk.

created
string

When this Linode was created.

status
string
Enum: "ready""not ready""deleting"

A brief description of this Disk's current state. This field may change without direct action from you, as a result of operations performed to the Disk or the Linode containing the Disk.

label
Filterable
string

The Disk's label is for display purposes only.

size
Filterable
integer

The size of the Disk in MB.

updated
string

When this Linode was last updated.

filesystem
string
Enum: "raw""swap""ext3""ext4""initrd"

The Disk filesystem can be one of:

  • raw - No filesystem, just a raw binary stream.
  • swap - Linux swap area.
  • ext3 - The ext3 journaling filesystem for Linux.
  • ext4 - The ext4 journaling filesystem for Linux.
  • initrd - initrd (uncompressed initrd, ext2, max 32 MB).
page
integer
pages
integer
results
integer

default: Error

errors
array of objects
reason
string

What happened to cause this error. In most cases, this can be fixed immediately by changing the data you sent in the request, but in some cases you will be instructed to open a Support Ticket or perform some other action before you can complete the request successfully.

field
string

The field in the request that caused this error. This may be a path, separated by periods in the case of nested fields. In some cases this may come back as "null" if the error is not specific to any single element of the request.

Create Disk

post
https://api.linode.com/v4/linode/instances/{linodeId}/disks

Adds a new Disk to a Linode. You can optionally create a Disk from an Image (see /images for a list of available public images, or use one of your own), and optionally provide a StackScript to deploy with this Disk.

Authorizations

Personal Access Token
OAuth: ( linodes:read_write)

Path Parameters

linodeId
Required
integer

ID of the Linode to look up.

Request Body Schema

label
Required
Filterable
string [1 .. 48] characters

The Disk's label is for display purposes only.

size
Required
Filterable
integer
authorized_keys
array

A list of public SSH keys that will be automatically appended to the root user's ~/.ssh/authorized_keys file.

authorized_users
array

A list of usernames that will have their SSH keys, if any, automatically appended to the root user's ~/.ssh/authorized_keys file.

filesystem
string
Enum: "raw""swap""ext3""ext4""initrd"

The Disk filesystem can be one of:

  • raw - No filesystem, just a raw binary stream.
  • swap - Linux swap area.
  • ext3 - The ext3 journaling filesystem for Linux.
  • ext4 - The ext4 journaling filesystem for Linux.
  • initrd - initrd (uncompressed initrd, ext2, max 32 MB).
image
string

An Image ID to deploy the Disk from. Official Linode Images start with linode/, while your Images start with private/. See /images for more information on the Images available for you to use.

read_only
boolean

If true, this Disk is read-only.

root_pass
string <password>[6 .. 128] characters ^(((?=.*[a-z])(?=.*[A-Z]))|((?=.*[a-z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[!"#$%&'()*+,-.\/:;<=>?@\[\]^_`{|}~\\]))|((?=.*[A-Z])(?=.*[!"#$%&'()*+,-.\/:;<=>?@\[\]^_`{|}~\\]))|((?=.*[0-9])(?=.*[!"#$%&'()*+,-.\/:;<=>?@\[\]^_`{|}~\\])))

This will set the root user's password on the newly-created Linode. The root password must conform to the following constraints:

  • May only use alphanumerics, punctuation, spaces, and tabs.
  • Must contain at least two of the following characters classes:
    • Upper-case letters
    • Lower-case letters
    • Digits
    • Punctuation
stackscript_data
object

This field is required only if the StackScript being deployed requires input data from the User for successful completion. See Variables and UDFs for more details. This field is required to be valid JSON.

stackscript_id
integer

A StackScript ID that will cause the referenced StackScript to be run during deployment of this Linode. A compatible image is required to use a StackScript. To get a list of available StackScript and their permitted Images see /stackscripts. This field cannot be used when deploying from a Backup or a private Image.

Request Samples

curl -H "Content-Type: application/json" \
    -H "Authorization: Bearer $TOKEN" \
    -X POST -d '{
      "label": "Debian 9 Disk",
      "image": "linode/debian9",
      "size": 1300,
      "authorized_keys": [
        "ssh-rsa AAAA_valid_public_ssh_key_123456785== user@their-computer"
      ],
      "authorized_users": [
        "myUser",
        "secondaryUser"
      ],
      "root_pass": "aComplexP@ssword",
      "stackscript_id": 10079,
      "stackscript_data": {
        "gh_username": "linode"
      }
    }' \
    https://api.linode.com/v4/linode/instances/123/disks

Response Samples

{
  "id": 1234,
  "label": "Debian 9 Disk",
  "status": "ready",
  "created": "2018-01-01T00:01:01",
  "size": 48640,
  "updated": "2018-01-01T00:01:01",
  "filesystem": "ext4"
}

Responses

200: Disk created.

id
integer

This Disk's ID which must be provided for all operations impacting this Disk.

label
Filterable
string [1 .. 48] characters

The Disk's label is for display purposes only.

status
string
Enum: "ready""not ready""deleting"

A brief description of this Disk's current state. This field may change without direct action from you, as a result of operations performed to the Disk or the Linode containing the Disk.

created
string <date-time>

When this Linode was created.

size
Filterable
integer

The size of the Disk in MB.

updated
string <date-time>

When this Linode was last updated.

filesystem
string
Enum: "raw""swap""ext3""ext4""initrd"

The Disk filesystem can be one of:

  • raw - No filesystem, just a raw binary stream.
  • swap - Linux swap area.
  • ext3 - The ext3 journaling filesystem for Linux.
  • ext4 - The ext4 journaling filesystem for Linux.
  • initrd - initrd (uncompressed initrd, ext2, max 32 MB).

default: Error

errors
array of objects
reason
string

What happened to cause this error. In most cases, this can be fixed immediately by changing the data you sent in the request, but in some cases you will be instructed to open a Support Ticket or perform some other action before you can complete the request successfully.

field
string

The field in the request that caused this error. This may be a path, separated by periods in the case of nested fields. In some cases this may come back as "null" if the error is not specific to any single element of the request.