What is block storage?

Block storage is a type of cloud storage that works by dividing data into blocks. Block storage allows for quick data retrieval.

Learning Objectives

After reading this article you will be able to:

  • Define block storage
  • Describe how block storage works
  • Understand how block storage compares to object storage

Related Content

Want to keep learning?

Subscribe to theNET, Cloudflare's monthly recap of the Internet's most popular insights!

Refer to Cloudflare's Privacy Policy to learn how we collect and process your personal data.

Copy article link

What is block storage?

Block storage is a type of cloud storage that divides files and data into equally sized blocks. This storage method allows for fast retrieval of data, since it does not rely on a file system. Think of the difference between looking through a city library's digital catalog to find a book, and knowing exactly where a book is on the shelves. The former is more like file storage; the latter is more like block storage.

Developers often prefer block storage for applications that regularly need to load data from the backend. Block storage is fast and scales up extremely well. It also works well with several types of computing and networking models, including container computing, virtual machines, and storage area networks (SANs).

However, block storage is not without its downsides. File metadata has to be very basic and usually cannot be customized (imagine a library where only the title of a book is recorded). Block storage is also a more costly storage option than some other cloud storage models, like object storage.

How does block storage work?

Data write

When an application that uses block storage writes data to the block storage database, instead of storing it as one file, it divides the data into several sections — the "blocks." These blocks do not have to be stored in any particular order.

Unique identifier

Each block has a unique identifier number that enables the application to find it later.

Data lookup table

These unique identifiers are stored in a data lookup table — a format that allows the application to easily find where each block is when it is needed.

Data read

Whenever data stored in the blocks is requested, the application consults the data lookup table to find where the requested data is stored. Usually, the requested data is spread out over multiple blocks. The application uses the identifiers from the table to retrieve the data, and it merges the disparate blocks back into their original form.

What are the benefits of block storage? What are the downsides?

Benefits include:

  • Block storage is fast: The use of unique identifiers, rather than searching for data using metadata or a file hierarchy, means that data can be retrieved extremely quickly.
  • There are multiple paths to data: Block storage allows data to be reached in multiple ways, since the unique identifier is all that is needed for retrieval. By contrast, file storage involves following the file hierarchy path until arriving at the desired file.

Downsides include:

  • Block storage is expensive: Partially because it is optimized for fast performance, block storage costs more than object storage. Consider how a race car costs more than a large passenger van.
  • Block storage metadata is limited: Block storage only includes basic file attributes as metadata.

How does block storage compare to object storage?

Object storage keeps files and data in what is called a "data lake," a non-hierarchical collection of unstructured data. Any type of data or file format can go into object storage, which means that unlike block storage, metadata can be complex and customized. Media (such as video and audio), logs, and disaster recovery backups are some of the common uses for object storage, although it is extremely flexible and works with a variety of use cases.

Because object storage is not structured or hierarchical, it can quickly, and almost limitlessly, store vast quantities of data — just as tossing clothes loosely into a big bag is a faster way to pack for a vacation than carefully folding and sorting clothes into a suitcase. However, much like packing in this fashion, object storage can make data retrieval less efficient.

Object storage vs. block storage Object storage Block storage
Storage capacity Almost unlimited Depends on vendor
Data retrieval Sometimes slow Fast
Metadata Customizable Basic, limited

Blob storage is another type of object storage, used for Binary Large Objects (colloquially called "blobs"). It also works best for unstructured data that does not need to be retrieved often.

How does block storage compare to file storage?

Cloud file storage is essentially a traditional hierarchy of files and folders, hosted in the cloud. Folders of data nest within directories and subdirectories, and inside each folder, files are tagged with metadata for easy identification. File storage keeps data organized, but it does not scale up to large amounts of data very well. Going through the hierarchy adds time to data retrieval.

However, file storage may work just fine for some use cases. Individuals who do not need to store and retrieve data on an enterprise-level scale may find that file storage fits their needs.

What is Cloudflare R2?

The cost of data retrieval, also known as data egress, is a major concern for organizations today. To combat these rising costs, Cloudflare offers zero-egress-fee object storage via a service called Cloudflare R2. R2 allows for fast and free data retrieval, and when paired with Cloudflare Workers' distributed code functions, it is endlessly customizable. Cloudflare aims to help developers and organizations avoid vendor lock-in with this service.