Block Storage
Block Storage provides persistent, disk-like storage that can be attached to cloud instances, allowing data to survive instance restarts and be moved between instances.
What is Block Storage in cloud hosting?
Block Storage is a type of cloud storage that presents data as fixed-size chunks called blocks. Each block acts like a raw disk partition that an operating system can format and use for file systems, databases, or other applications. When you attach Block Storage to a cloud instance (virtual machine), the operating system sees it as a local hard drive.
Unlike the storage that comes built into an instance, Block Storage exists independently on the cloud provider's storage infrastructure. This separation means your data persists even when you delete, restart, or resize the instance it was attached to.
Related Terms
- Volume: A unit of Block Storage that you create and attach to instances, such as a 100GB volume for a database server.
- Instance: A virtual machine in the cloud that uses Block Storage for persistent data, such as a web server running Linux.
- Snapshot: A point-in-time backup of a volume that captures all block data, such as a snapshot taken before a major upgrade.
- Flavor: A predefined resource template that defines instance size but does not include Block Storage, such as a 4-vCPU flavor.
- Object Storage: An alternative storage type that stores data as objects with metadata, such as images or backups accessed via API.
Why Block Storage Exists
Cloud instances have root disks (often called ephemeral storage) that live only as long as the instance exists. When you terminate an instance, that root disk disappears along with all data stored on it.
Block Storage solves three problems:
Data persistence. Databases, application files, and user uploads need to survive instance failures and planned maintenance. Without Block Storage, every instance restart or termination would mean data loss.
Data portability. Teams often need to move data between instances. Block Storage can be detached from one instance and attached to another, allowing you to migrate workloads or recover from hardware failures without copying data over the network.
Capacity flexibility. Instances come with fixed root disk sizes determined by their flavor. Block Storage lets you add exactly as much additional storage as you need, when you need it, without changing your instance type.
What Does Block Storage Actually Do?
- Provides raw storage that the operating system sees as a local disk device
- Stores data on redundant hardware separate from the instance's compute node
- Allows you to create volumes of specific sizes (e.g., 50GB, 500GB, 2TB)
- Supports attaching multiple volumes to a single instance
- Enables detaching volumes from one instance and reattaching to another
- Persists data independently of instance lifecycle
- Supports creating snapshots for point-in-time backups
- Delivers consistent I/O performance specified by the volume type
When Would I Use Block Storage?
Running a database. MySQL, PostgreSQL, MongoDB, and other databases require storage that persists across restarts. Storing database files on Block Storage ensures your data survives instance maintenance, crashes, or upgrades.
Hosting application data. Web applications that store user uploads, configuration files, or generated content need persistent storage. Block Storage keeps this data safe even if you need to rebuild or resize your instance.
Separating concerns. When you want to manage storage independently from compute, Block Storage lets you scale each resource separately. You can increase storage capacity without changing your instance type.
Creating backups. Block Storage supports snapshots that capture the exact state of your volume. You can use these to restore data, create new volumes, or migrate to different regions.
When Would I NOT Use Block Storage?
Storing large static files accessed via HTTP. Images, videos, and downloadable files served directly to users are better stored in Object Storage, which provides built-in HTTP access and scales more cost-effectively for this use case.
Sharing data between multiple instances simultaneously. Block Storage volumes typically attach to only one instance at a time. If multiple instances need access to the same data concurrently, consider Object Storage or a shared file system.
Temporary scratch data. Processing jobs that create temporary files which are discarded after completion can use the instance's ephemeral storage. Block Storage adds cost and complexity for data you do not need to keep.
Extremely high IOPS requirements. Some Block Storage offerings have I/O limits that may not meet extreme performance demands. Check your provider's specifications before assuming Block Storage suits high-frequency trading systems or similar workloads.
Real-World Example
Company A runs an e-commerce platform on cloud instances. Their application uses a PostgreSQL database to store product catalogs, customer accounts, and order history.
Initially, they stored the database on the instance's root disk. When a hardware failure forced the cloud provider to move their instance to new hardware, the root disk was lost. Company A had to restore from a 12-hour-old backup, losing half a day of orders.
After this incident, Company A created a 200GB Block Storage volume and moved their PostgreSQL data directory onto it. Now their database files exist independently of the instance. When they resize their instance to handle holiday traffic, the Block Storage volume stays intact. They also schedule daily snapshots of the volume, enabling point-in-time recovery if data corruption occurs.
Frequently Asked Questions
Can I attach one Block Storage volume to multiple instances?
Most cloud platforms only allow attaching a volume to one instance at a time. If you need shared storage across instances, consider Object Storage for file access via API, or configure a network file system that uses Block Storage as its backend.
What happens to my data if I delete the instance but keep the volume?
Your data remains on the volume. Block Storage volumes exist independently, so deleting the instance does not affect the volume unless you explicitly configure the volume to be deleted with the instance. You can attach the volume to a different instance later.
How do I increase the size of an existing volume?
Most cloud platforms allow you to expand a volume's capacity. The process typically involves detaching the volume (or using live resize if supported), increasing the size through the cloud console or API, then extending the filesystem from within the operating system.
What is the difference between Block Storage and the instance's root disk?
The root disk comes with the instance and is defined by the flavor you choose. It stores the operating system and may be ephemeral (deleted when the instance terminates). Block Storage volumes are created separately, persist independently, can be any size you choose, and can be moved between instances.
How do snapshots work with Block Storage?
A snapshot captures the exact state of all blocks in a volume at a specific moment. You can create a new volume from a snapshot to restore data or duplicate it. Snapshots are typically stored in Object Storage on the backend and may be incremental, storing only changed blocks since the previous snapshot.
Summary
- Block Storage provides persistent, disk-like storage that attaches to cloud instances as raw block devices.
- Data on Block Storage volumes survives instance restarts, terminations, and migrations.
- Volumes can be detached from one instance and attached to another, enabling data portability.
- Block Storage is essential for databases, application files, and any data that must persist beyond the instance lifecycle.
- Snapshots enable point-in-time backups and volume duplication without manual file copying.
