Volume
A volume is a block storage device that provides persistent data storage for instances in cloud hosting. It functions like an external hard drive that can be attached to, detached from, and moved between instances while retaining all stored data.
What is a Volume in cloud hosting?
A volume is a block storage device that provides persistent data storage for instances (virtual machines) in cloud hosting. In OpenStack-based clouds, volumes are provided by the Cinder block storage service: they appear as raw block devices that you format with a filesystem and mount like a physical drive. A volume functions like an external hard drive that can be attached to, detached from, and moved between instances while retaining all stored data.
Volumes exist independently from the instances they serve. When you delete an instance, its attached volumes remain intact unless you explicitly choose to delete them. This separation between compute and storage allows you to preserve data, create backups, and move storage between different instances as your needs change.
Why Volumes Exist
Without volumes, instances would rely solely on their root disk (often called ephemeral storage) for all storage needs. Root disks are tied directly to the instance lifecycle. When the instance is deleted, the root disk and everything stored on it is destroyed. This creates several problems:
First, you cannot preserve data when replacing or upgrading an instance. Every time you need to change instance size or rebuild your server, you must manually back up data, delete the old instance, create a new one, and restore the data.
Second, you cannot share storage between instances. If multiple servers need access to the same dataset, you must duplicate that data across each instance, wasting storage space and creating synchronization problems.
Third, storage capacity is fixed at instance creation. If your application grows and needs more disk space, you cannot expand the root disk without rebuilding the entire instance.
Volumes solve these problems by separating storage from compute. You can attach volumes to any compatible instance, detach them without data loss, expand their capacity, create backups, and manage them independently from the instances that use them.
What Do Volumes Actually Do?
- Provides persistent storage that survives instance deletion, allowing you to preserve data when you delete, resize, or replace an instance.
- Attaches to instances as an additional block device, appearing as /dev/vdb, /dev/vdc, or similar paths on Linux systems, or as additional drives on Windows systems.
- Stores data independently from the instance, so you can detach a volume from one instance and attach it to another (within the same availability zone) without copying files or losing data.
- Supports capacity expansion while in use, allowing you to increase volume size from 100GB to 500GB without detaching it or stopping your application.
- Enables snapshot creation for backups, letting you capture the complete state of a volume at any moment and restore from that snapshot later.
- Allows simultaneous attachment to multiple instances when configured with appropriate storage backends, supporting shared storage scenarios like clustered databases.
- Can serve as a bootable root disk in supported environments, allowing instances to boot from persistent storage instead of ephemeral disk.
When Would I Use Volumes?
You would use volumes in these common situations:
Database storage: Attach a volume to your database instance to store database files. If you need to upgrade the database server to a larger instance size, detach the volume, delete the old instance, create a new larger instance, and attach the same volume without losing any database data.
Application data separation: Run your web application on the instance's root disk but store user uploads, logs, and session data on an attached volume. This separation lets you snapshot the data volume independently and manage application code updates without affecting stored user data.
Storage capacity expansion: Start an instance with a 50GB volume for application logs. When logs grow and fill the volume, expand it to 200GB without stopping the application or creating a new instance.
Development and testing: Create a volume containing a complete dataset for testing. Attach that volume to different test instances as needed, allowing multiple developers to test against identical data without duplicating storage.
Backup and disaster recovery: Take daily snapshots of volumes containing critical data. If data corruption occurs or an instance fails, create a new volume from the most recent snapshot and attach it to a new or existing instance.
When Would I NOT Use Volumes?
Volumes are not appropriate in several situations:
Temporary or cache data: Volumes add cost and management overhead. If your application only needs temporary storage for cache files, processing queues, or ephemeral data that can be safely deleted, use the instance's root disk or local temporary storage instead.
Very small storage needs: If your application requires less than 20GB of total storage and fits comfortably within the instance's root disk, adding a separate volume introduces unnecessary complexity without benefit.
Maximum performance requirements: While volumes provide good performance, they transfer data over the network between the instance and storage backend. Applications requiring the absolute lowest latency, such as high-frequency trading systems or real-time analytics, may perform better with local NVMe storage directly attached to the physical host.
Immutable infrastructure patterns: If you practice immutable infrastructure where you never modify running instances and instead replace them entirely with new instances built from updated images, you may not need volumes. In this pattern, you typically store all persistent data in external services like object storage or managed databases rather than on attached volumes.
Simple static websites: A basic static website with HTML, CSS, and JavaScript files that rarely change can run entirely from the instance's root disk. Adding volumes for such simple workloads provides no practical advantage and complicates deployment.
Real-World Example
Company A runs an e-commerce platform on InMotion Cloud. They deploy their web application on a medium instance with a 40GB root disk.
Initially, they store product images and customer uploads directly on the root disk. As the business grows, the root disk fills up. They realize they need more storage and want to protect customer data from accidental instance deletion.
Company A creates a 500GB volume and attaches it to their instance at /dev/vdb. They format it with ext4, mount it at /var/www/uploads, and migrate all product images and customer files to the volume.
Now when the root disk fills with application logs, Company A can simply expand the volume from 500GB to 1TB without any downtime. They also configure daily snapshots of the volume to protect against data loss.
Six months later, Company A needs to upgrade to a larger instance to handle increased traffic. They detach the 1TB volume from the old instance, delete it, create a new larger instance, and attach the same volume. All customer data remains intact throughout the upgrade, and the migration takes only a few minutes instead of hours of data copying.
Frequently Asked Questions
Do I need more than one volume per instance?
Most applications work well with a single volume for all persistent data. However, you might use multiple volumes to separate different types of data for management purposes. For example, you could attach one volume for database files and another volume for application logs, allowing you to snapshot them on different schedules and manage their capacity independently. Use multiple volumes when you need different backup policies, different performance characteristics, or plan to move specific datasets between instances separately.
Does creating a volume affect existing instances?
No. Creating a volume has no impact on running instances. The volume exists as an independent storage resource until you explicitly attach it to an instance. After you create a volume, you must attach it to an instance, then log into that instance and format the volume with a filesystem before you can store data on it.
What happens if I delete a volume?
All data stored on that volume is permanently destroyed. This occurs immediately and cannot be undone. Before deleting a volume, ensure you have snapshots or backups of any data you need to preserve. You cannot delete a volume while it is attached to an instance. You must first detach it, then delete it.
Can I attach the same volume to multiple instances?
This depends on your cloud provider's storage backend configuration. Most volume implementations support single-instance attachment only, meaning a volume can attach to only one instance at a time. Some storage backends support multi-attach mode, where a volume can attach to multiple instances simultaneously, but this requires careful filesystem coordination to prevent data corruption. If you need shared storage across instances, consult your cloud provider's documentation about multi-attach support and use appropriate cluster-aware filesystems like GFS2 or OCFS2.
How do I expand a volume that is running out of space?
First, expand the volume's capacity through your cloud provider's API or dashboard. This increases the volume size at the storage level. Then, log into the instance and use filesystem tools to expand the filesystem to use the new space. On Linux with ext4, run sudo resize2fs /dev/vdb to expand the filesystem. The exact commands vary by operating system and filesystem type, but you typically can perform this expansion without detaching the volume or stopping your application.
Summary
- A volume is block storage that provides persistent data storage for instances in cloud hosting, functioning like an external drive that retains data independently from the instance lifecycle.
- Volumes attach to instances as additional storage devices, can be detached and moved between instances, expanded in capacity, and backed up through snapshots.
- Use volumes to preserve data during instance changes, separate application code from data, expand storage capacity, enable backups, and share data between instances.
- Avoid volumes for temporary data, very small storage needs, or simple static workloads where the instance's root disk provides sufficient capacity.
- Volumes exist independently from instances, allowing you to manage compute and storage resources separately based on your application's changing needs.
Sources:
- Introduction to the Block Storage service — OpenStack Cinder Documentation
- Red Hat OpenStack Platform 17.1 - Configuring the Block Storage service (cinder)
- OpenStack Cinder: Comprehensive Guide to Block Storage Management
Related Terms
Understanding volumes requires familiarity with several cloud hosting concepts:
- Instance (virtual machine): The compute resource where your applications run, such as a web server or database server that needs storage to hold application files and data.
- Snapshot (point-in-time backup): A saved copy of a volume's entire contents at a specific moment, such as a backup taken before a major software upgrade or system change.
- Flavor (predefined resource template): The configuration that defines an instance's compute resources including its root disk size, such as a small flavor with 20GB root disk or a large flavor with 100GB root disk.
- Block storage: The underlying technology that volumes use to provide raw storage blocks that instances format with filesystems, such as ext4 on Linux or NTFS on Windows instances.
