LinuxCommandLibrary

openstack-volume

Manage OpenStack Block Storage volumes

TLDR

List volumes

$ openstack volume list --all-projects
copy

Show volume details
$ openstack volume show [volume_id]
copy

Create new volume
$ openstack volume create --size [size_in_GB] --image [image_id] --snapshot [snapshot_id] [--bootable|--non-bootable] [volume_name]
copy

Delete volumes(s)
$ openstack volume delete [volume_id1 volume_id2 ...]
copy

Migrate volume to a new host
$ openstack volume migrate --host [host_hostname] [instance_id]
copy

Set volume properties
$ openstack volume set --name [volume_new_name] --size [volume_new_size] [--attached|--detached] [--bootable|--non-bootable] [volume_id]
copy

SYNOPSIS

openstack [global-options] volume <subcommand> [subcommand-options] [arguments]

Common Subcommands:
  create <size> <name> [options]
  list [options]
  show <volume-id-or-name>
  delete <volume-id-or-name> [...]

PARAMETERS

--debug
    Enable debug output for the OpenStack client.

--verbose
    Enable verbose output, showing more details for the command execution.

--os-cloud <cloud-name>
    Use the specified cloud configuration from clouds.yaml.

--os-region-name <region-name>
    Specify the OpenStack region to operate in.

--os-project-id <id> | --os-project-name <name>
    Authenticate to a specific project by ID or name.

--os-user-id <id> | --os-user-name <name>
    Authenticate with a specific user by ID or name.

--format <format>
    Specify output format (e.g., 'json', 'yaml', 'table', 'value').

--help
    Show help message and exit. Can be used with subcommands (e.g., 'openstack volume create --help').

DESCRIPTION

The command openstack volume is part of the unified OpenStack command-line client, used for managing block storage volumes (provided by the Cinder service) within an OpenStack cloud. While the request specifically mentions 'openstack-volume', this is typically a legacy wrapper or a misconception. The standard and widely used command for interacting with OpenStack's Cinder service is openstack volume followed by a specific subcommand.

This utility allows cloud administrators and users to perform a wide array of operations on block storage, including creating, deleting, listing, showing details, attaching, and detaching volumes from compute instances. It also supports operations like creating volume snapshots, managing volume types, and extending existing volumes. It provides a programmatic interface to Cinder's REST API, enabling scripting and automation of storage resource management.

CAVEATS

The command 'openstack-volume' is typically a legacy reference. Modern OpenStack client installations use 'openstack volume' as a subcommand within the unified openstack CLI tool.

Requires the OpenStack client to be installed and properly configured with authentication credentials (e.g., via environment variables or a clouds.yaml file).

Operations on volumes can be asynchronous; commands may return before the volume fully reaches its desired state (e.g., 'creating', 'available'). Check volume status with openstack volume show.

COMMON VOLUME OPERATIONS

Beyond basic creation and deletion, openstack volume supports advanced operations:
  Attachment/Detachment: Linking volumes to/from compute instances.
  Snapshotting: Creating point-in-time backups of volumes.
  Cloning: Creating new volumes from existing ones or snapshots.
  Extending: Increasing the size of an existing volume.
  Type Management: Associating volumes with specific performance or storage backend characteristics.

CINDER SERVICE

Cinder is OpenStack's block storage service, providing persistent block storage devices to guest virtual machines. It abstracts various backend storage technologies (like LVM, Ceph, NetApp, EMC) and presents them as a unified API. The openstack volume command interacts directly with the Cinder API to manage these storage resources.

HISTORY

Prior to the unified OpenStack client, volume management was primarily handled by the dedicated cinderclient and its cinder command. As OpenStack matured, the community moved towards a single, comprehensive command-line interface, leading to the development of the python-openstackclient and the openstack command. The openstack volume subcommand absorbed the functionality previously provided by the cinder CLI, providing a more consistent user experience across OpenStack services. This transition aimed to simplify client installations and usage by consolidating various service-specific clients into one.

SEE ALSO

openstack(1), openstack server(1), openstack image(1), openstack network(1), openstack snapshot(1)

Copied to clipboard