LinuxCommandLibrary

linode-cli-volumes

Manage Linode block storage volumes

TLDR

List current Volumes

$ linode-cli volumes list
copy

Create a new Volume and attach it to a specific Linode
$ linode-cli volumes create --label [volume_label] --size [size_in_GB] --linode-id [linode_id]
copy

Attach a Volume to a specific Linode
$ linode-cli volumes attach [volume_id] --linode-id [linode_id]
copy

Detach a Volume from a Linode
$ linode-cli volumes detach [volume_id]
copy

Resize a Volume (Note: Size can only be increased)
$ linode-cli volumes resize [volume_id] --size [new_size_in_GB]
copy

Delete a Volume
$ linode-cli volumes delete [volume_id]
copy

SYNOPSIS

linode-cli volumes <subcommand> [options]

Common subcommands include:
list: Display a list of all Block Storage Volumes.
create: Create a new Block Storage Volume.
view <volume_id>: Display detailed information about a specific Volume.
update <volume_id>: Modify the label of a specific Volume.
delete <volume_id>: Delete a Block Storage Volume.
attach <volume_id>: Attach a Volume to a Linode Instance.
detach <volume_id>: Detach a Volume from a Linode Instance.
resize <volume_id>: Increase the size of a Volume.
clone <volume_id>: Create a new Volume from an existing one.
migrate <volume_id>: Migrate a Volume to a different region.

PARAMETERS

--label
    Assign a human-readable display name to the Volume. Used when creating, updating, or cloning.

--region
    Specify the data center region where the Volume will be deployed. Required for creation and cloning, and for migration target.

--size
    Define the size of the Volume in GiB (Gigabytes). Used during creation and resizing.

--linode_id
    The ID of the Linode Compute Instance to which the Volume should be attached or detached. Optional at creation for immediate attachment.

--filters
    Apply filters in JSON format to narrow down results when listing volumes (e.g., '{"label": "my-volume"}').

--page
    Specify a particular page number when listing results with pagination.

--pages
    Request a specific number of pages for listing results, useful with `--page`.

--order_by
    Sort the listed results by a specified field (e.g., 'label', 'created').

--order
    Set the sort order for listed results: 'asc' for ascending or 'desc' for descending.

DESCRIPTION

The linode-cli volumes command provides a comprehensive interface for creating, listing, viewing, updating, deleting, and attaching/detaching Linode Block Storage Volumes. These volumes offer persistent storage that can be attached to Linode Compute Instances, providing scalable and independent storage solutions.

Users can define volume size, label, and specify the region for deployment. It integrates seamlessly with other Linode CLI functionalities, allowing for programmatic control over storage resources within the Linode cloud environment. This command is crucial for managing data persistence and expanding storage capacity beyond the ephemeral storage of compute instances.

CAVEATS

Block Storage Volumes must reside in the same Linode data center region as the Linode Compute Instance they are attached to.
Volumes can only be resized to a larger size; decreasing a volume's size is not supported.
Deleting a volume is an irreversible action and will permanently remove all data stored on it.
Ensure your Linode API token has the necessary read/write permissions for volumes to perform all operations.

SUBCOMMAND USAGE

The linode-cli volumes command is a parent command that requires a subcommand to perform specific actions. For instance, to list volumes, you use linode-cli volumes list; to create one, linode-cli volumes create.

Each subcommand has its own specific set of required and optional parameters, defining the action and the data involved in the operation (e.g., volume_id for operations on an existing volume, or --label, --size for creation).

DATA PERSISTENCE AND MOBILITY

Linode Block Storage Volumes provide crucial data persistence, meaning your data remains even if the associated Linode Compute Instance is deleted or reconfigured. They can be detached from one Linode and re-attached to another within the same region, offering flexibility and data mobility for applications and databases.

HISTORY

Linode introduced Block Storage as a service to provide persistent, independent storage solutions for Linode instances, addressing the need for scalable and portable data.

The linode-cli was developed to offer a powerful, programmatic, and scripting-friendly interface to manage all Linode resources, including volumes. The volumes command specifically evolved to encapsulate the full lifecycle operations (create, modify, delete, attach, detach, resize, clone, migrate) through a consistent command-line interface, mirroring the functionality available in the Linode Cloud Manager UI and directly interacting with the Linode API.

SEE ALSO

linode-cli linodes(1), linode-cli regions(1), lsblk(8), mount(8)

Copied to clipboard