Attaching and Detaching Volumes in OpenStack Horizon
Managing block storage volumes in OpenStack Horizon is a fundamental task for cloud administrators and developers working with persistent data. Volumes provide independent, persistent storage that can be attached to instances, detached, and moved between instances without data loss.
This guide walks you through the complete process of attaching volumes to instances, detaching them when needed, and viewing volume details through the Horizon dashboard.
What Are Cinder Volumes?
Cinder volumes provide block storage in OpenStack. Think of them as virtual hard drives that exist independently of your instances. Unlike ephemeral instance storage that disappears when an instance is deleted, Cinder volumes persist your data and can be:
- Attached to running instances
- Detached and moved to different instances
- Backed up for disaster recovery
- Resized to accommodate growing data needs
- Snapshotted for point-in-time recovery
Volumes are particularly useful for databases, application data, logs, and any content that must survive instance lifecycle events.
Prerequisites
Before attaching or detaching volumes, ensure you have:
- Active OpenStack Horizon dashboard access
- At least one running instance
- One or more available volumes in the same availability zone as your target instance
- Appropriate permissions to manage volumes and instances
Important: Volumes can only be attached to instances in the same availability zone. Cross-zone attachment is not supported due to underlying storage architecture constraints.
How to Attach a Volume to an Instance
Attaching a volume makes the block storage device available to your instance. The operating system will see it as a new disk that can be formatted, mounted, and used for data storage.
Method 1: Attach from the Volumes Page
- Navigate to Project > Volumes > Volumes in the Horizon sidebar
- Locate the volume you want to attach in the volumes list
- The volume status should show "Available" (only available volumes can be attached)
- Click the dropdown arrow next to the Manage Attachments button for your target volume
- Select Attach Volume from the actions menu
- In the dialog that appears:
- Attach to Instance: Select the instance from the dropdown menu
- Device Name (optional): Leave blank to auto-assign, or specify a device path like
/dev/vdc
- Click Attach Volume to confirm
The volume status will change from "Available" to "In-use" once the attachment completes. This typically takes 2 to 5 seconds.
Method 2: Attach from the Instance Details Page
- Navigate to Project > Compute > Instances
- Click the instance name to view its details page
- Select the Volumes tab
- Click the Attach Volume button
- In the dialog:
- Volume: Select the volume from the dropdown list (only available volumes in the same zone appear)
- Device Name (optional): Auto-assigned if left blank
- Click Attach Volume
The attached volume will appear in the instance's volumes list with the device name and attachment time.
Understanding Device Names
When you attach a volume, OpenStack assigns it a device identifier such as /dev/vdb, /dev/vdc, or /dev/sda. These device names represent how the operating system sees the storage device.
Best practice: Let OpenStack auto-assign device names unless you have a specific requirement. Auto-assignment prevents conflicts with existing devices.
After attachment, you must log into the instance to format and mount the volume before you can use it for data storage. The volume appears as a raw block device until you create a filesystem on it.
How to Detach a Volume from an Instance
Detaching a volume disconnects the block storage device from the instance. The data on the volume remains intact and the volume returns to "Available" status, ready to be attached to another instance if needed.
Critical warning: Always unmount the volume from within the operating system before detaching it through Horizon. Detaching a mounted volume can cause filesystem corruption and data loss.
Unmount the Volume First (Required)
Before detaching through Horizon, connect to your instance and unmount the volume:
For Linux instances:
1# List mounted volumes to confirm the mount point2df -h34# Unmount the volume (replace /mnt/volume with your actual mount point)5sudo umount /mnt/volume
For Windows instances:
- Open Disk Management
- Right-click the volume
- Select Offline to safely disconnect it
Detach Through Horizon
Once the volume is unmounted at the OS level:
- Navigate to Project > Volumes > Volumes
- Find the volume you want to detach
- The status should show "In-use" with the attached instance name visible
- Click the dropdown next to Manage Attachments
- Select Detach Volume from the menu
- Confirm the detachment in the dialog
The volume status changes from "In-use" to "Available" within a few seconds. At this point, the volume is no longer accessible to the instance.
Detach from Instance Details Page
Alternatively, detach from the instance perspective:
- Navigate to Project > Compute > Instances
- Click the instance name to view details
- Go to the Volumes tab
- Click the Detach Volume button next to the target volume
- Confirm the action
Viewing Volume Details and Attachment Information
Understanding volume properties and attachment status helps you manage storage efficiently and troubleshoot issues.
View Volume Properties
- Navigate to Project > Volumes > Volumes
- Click the volume name to open the volume details page
- The Overview tab displays:
- Volume name and description
- Status (Available, In-use, Error, etc.)
- Size in gigabytes
- Volume type (HDD, SSD, performance tier)
- Availability zone
- Created date and time
- Bootable flag (whether the volume contains an OS image)
- Encrypted flag (if volume encryption is enabled)
Check Attachment Status
The Attachments section on the volume details page shows:
- Attached To: Instance name and ID
- Device: Device path as seen by the instance (e.g.,
/dev/vdb) - Attached At: Timestamp of attachment
If the volume is not attached, this section remains empty.
View Instance Volume List
To see all volumes attached to a specific instance:
- Navigate to Project > Compute > Instances
- Click the instance name
- Select the Volumes tab
- The table shows all attached volumes with:
- Volume name
- Device identifier
- Size
- Volume type
- Actions (detach button)
This view is particularly useful when managing instances with multiple attached volumes.
Common Volume Management Scenarios
Migrating Data Between Instances
To move a volume from Instance A to Instance B:
- Unmount the volume in Instance A's operating system
- Detach the volume from Instance A through Horizon
- Wait for status to change to "Available"
- Attach the volume to Instance B
- Log into Instance B and mount the volume
The data remains intact throughout this process. The filesystem and all files transfer without modification.
Expanding Storage Capacity
When an instance needs more storage:
- Create a new volume with the required size
- Attach the new volume to the instance
- Format and mount the volume within the OS
- Move or distribute data across the new volume
Alternatively, extend an existing volume using the Extend Volume action in Horizon (only available when the volume is detached).
Troubleshooting Attachment Failures
If a volume fails to attach:
- Check availability zone: Volume and instance must be in the same zone
- Verify volume status: Only "Available" volumes can be attached
- Check instance status: Instance must be active (running or stopped)
- Review quotas: Ensure you haven't exceeded your volume attachment limit
- Check for device conflicts: If specifying a device name manually, ensure it's not already in use
Volume Attachment Limits
OpenStack enforces limits on the number of volumes that can be attached to a single instance. The exact limit depends on your cloud provider's configuration, but typical limits are:
- Standard instances: 26 volumes (one per letter, /dev/vda through /dev/vdz)
- High-performance instances: May support fewer attachments due to hardware constraints
Check your instance flavor documentation or contact your cloud administrator for specific attachment limits in your environment.
Best Practices for Volume Management
Always unmount before detaching: This is the most critical rule. Detaching a mounted volume risks filesystem corruption and data loss.
Use descriptive volume names: Name volumes based on their purpose (e.g., "webapp-database", "logs-server-01") to avoid confusion in production environments.
Plan availability zones: Keep volumes and instances in the same zone to enable attachment. Cross-zone attachments are not possible.
Let OpenStack auto-assign device names: Manual device name assignment can cause conflicts. Use auto-assignment unless you have a specific technical requirement.
Monitor volume status: Volumes stuck in "Attaching" or "Detaching" states may indicate underlying infrastructure issues that require administrative intervention.
Test backup and restore procedures: Regularly verify that volume snapshots and backups can be restored successfully.
Next Steps
Now that you understand volume attachment and detachment, consider exploring:
- Volume snapshots: Create point-in-time backups of your volumes
- Volume backups: Export volumes to object storage for long-term retention
- Volume types: Choose the right performance tier (SSD vs HDD) for your workload
- Bootable volumes: Launch instances directly from volumes instead of images
Managing volumes effectively ensures your data remains available, portable, and protected throughout your cloud infrastructure's lifecycle.
