What is Block Storage

What is Block Storage / File Storage / Object Storage

Block storage and file storage are two mainstream storage types that we are familiar with, while object storage is a new network storage architecture. Devices based on object storage technology are called Object-based Storage Devices (OSDs).

As an introduction to storage types, this article will introduce three types of storage: block storage, file storage, and object storage.

what is Block storage?

Block storage mainly maps the entire raw disk space to be used by the host. It provides services at the physical layer and is formatted with its file system when used by a system. Once a system is using it, it becomes exclusive.

For example, if there are 5 hard disks in a disk array, they can be logically partitioned into N logical disks through logical partitioning, RAID, LVM, etc. However, logical disks and physical disks are completely different concepts. Assuming that each hard disk is 100G and there are 5 hard disks, 5 logical disks are partitioned, each with 100G, but these 5 logical disks are completely different from the original 5 physical disks. For example, the first 20G of the first logical disk may come from physical disk 1, and the second 20G may come from physical disk 2. The logical disk is a virtual disk constructed from multiple physical disks.

Then, block storage maps these logical disks to the host through mapping. The operating system on the host will recognize that there are 5 hard disks, but it cannot distinguish whether they are physical disks or logical disks. It will simply recognize them as 5 bare physical disks. Mounting a physical disk directly to the operating system is no different from mounting 5 bare physical disks.

In this way, the operating system also needs to partition and format the mounted bare disks before it can be used, which is no different from the built-in hard disks of the host.

Typical devices:

Disk arrays, hard disks

Advantages:

(1) It provides data protection through methods such as RAID and LVM.

(2) Multiple hard disks can be combined into a large-capacity logical disk to provide external services, increasing capacity.

(3) Since it is a combination of multiple disks, data can be written in parallel, improving read and write efficiency.

Disadvantages:

(1) Additional cost is required for purchasing fiber channel cards and switches for the host, which increases the cost.

(2) Data cannot be shared between hosts. When the block storage raw disk is mapped to the host and formatted for use, it is equivalent to a local disk for the host. Therefore, the local disk of host A cannot be used by host B, and data cannot be shared.

(3) It is not conducive to data sharing between hosts with different operating systems. After formatting, data cannot be shared between different file systems.

Use cases:

Docker containers, virtual machine disk storage allocation, log storage, file storage, etc.


what is File Storage?

File storage provides services at the file system layer, and systems can access it at the file system level through an interface. Various systems can access it according to the interface.

File storage can also be a software and hardware-integrated device, but actually, a regular PC with appropriate operating systems and software can act as an FTP or NFS server. After adding such services, the server becomes a type of file storage.

Host A can directly upload and download files to and from file storage. Unlike block storage, host A does not need to format file storage because the file management function is handled by file storage.

Typical devices:

FTP, NFS servers

Advantages:

(1) Low cost: a machine and a regular Ethernet are enough.

(2) Convenient file sharing.

Disadvantages:

Low read and write speed, slow transmission speed.

Use cases:

Log storage, file storage with directory structure, etc.


Object Storage

The reason for the emergence of object storage is to overcome the respective shortcomings of block storage and file storage and to develop their respective advantages. Simply put, block storage has fast read and write speeds but is not conducive to sharing, while file storage has slow read and write speeds but is conducive to sharing. Can we develop a storage system that is fast for reading and writing and also conducive to sharing? Thus, object storage was created.

Firstly, a file contains both metadata and content.

In file systems such as FAT32, the file and metadata are stored together. The storage process first breaks down the file into small blocks according to the minimum block size of the file system (e.g., for a 4M file and a 4K block size, the file is broken down into 1000 small blocks) and then writes them to the hard disk. During this process, there is no distinction between data and metadata. Each block will inform you of the next block address to be read, and then you follow the sequence to read all the blocks of the entire file.

In this case, the read and write speed is very slow, because even if 100 mechanical arms are reading and writing, only one arm can work. After all, it can only know where the next block is after reading the first block.

Object storage separates metadata, and the metadata server (server + object storage management software) is responsible for storing object attributes (mainly the information of which distributed servers the object's data is stored on), while other distributed servers responsible for storing data are called Object-based Storage Devices (OSDs). When a user accesses an object, they first access the metadata server, which only returns the location of the object on the OSD. For example, if the metadata server returns that file A is stored on OSDs B, C, and D, the user will directly access the 3 OSD servers to read the data.

At this point, because the data is transmitted externally by 3 OSD servers at the same time, the transmission speed will be accelerated. As the number of OSD servers increases, the speed of reading and writing will increase even more. Through this method, the goal of fast reading and writing is achieved.

On the other hand, object storage software has a dedicated file system, so OSD is also equivalent to a file server externally. Therefore, there is no difficulty in sharing, and the problem of file sharing is solved. The emergence of object storage has effectively combined the advantages of block storage and file storage.

Typical devices:

Distributed servers with built-in large-capacity hard drives.

How to access objects through object methods?

In the storage device, all objects have an object identifier, and objects are accessed through OSD commands using their identifier.

Advantages:

Has high-speed read and write capabilities like block storage.

Has features such as sharing and file storage.

Use cases:

Image storage, video storage, etc.


Conclusion

There is a type of application that requires storing data on a directly mapped raw disk, such as a database. Because the data needs to be stored on a raw disk mapped to itself and then formatted according to its database file system, it cannot use storage that has already been formatted with a certain file system. This type of application is more suitable for using block storage.

The cost of object storage is higher than that of ordinary file storage, as it requires purchasing specialized object storage software and large-capacity hard drives. If the data volume is not massive and only for file-sharing purposes, it is more cost-effective to use file storage directly.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *