Is ext4 considered file storage or block storage?
Asked Answered
E

3

5

I have been researching the differences between File, Block and Object storage. I've tried to relate the native Linux File System with one of these types of storing data, however, some doubts that come to my mind make me evidence that I have some kind of misconception here:

Intuitively, ext4 looks like File Storage type since it is defined as a "file system". Also, the root ("/") schema is organized in folders and files, just the same as File Storage definition.

On the other hand, ext4 uses inodes to separate files into blocks for better storage performance. This is a Block Storage feature. Also, Block Storage is the only storage type capable of booting an OS according to this IBM video: https://www.youtube.com/watch?v=PmxWTTpXNLI (min 7:52).

Does this mean that Linux kernel needs Block Storage for booting but then it mounts itself as a File Storage?

Ensheathe answered 1/3, 2022 at 11:25 Comment(3)
You can create a filesystem on a block device. Can you create a filesystem on top of ext4?Addict
As I know, such "File storage" or "Block storage" concept applies on data storage over network (NAS, SAN, etc.). They have nothing to do if you are using single local disk device.Stand
@Addict Yes, for example it is not uncommon for VMs to have disk images stored as files.Teratology
U
15

ext4, and any filesystem, is by definition "file storage". That's what a filesystem is.


The terms "file storage", "block storage", and "object storage" refers to the API that the storage exports to its consumers, regardless of the transport (network, local, etc.).

ext4 exports a file API (create directories, open files within directories etc.), and is therefore file storage.
If ext4 let you issue inode-based syscalls, it could also count as object storage, because inodes are not aware of hierarchy - the directory hierarchy layer is implemented on top of inodes.

Hard drives, on the other hand, only provide "read at this offset" and "write at this offset" kind of API, and are therefore block storage.

This API is simple enough that it can be used by the lowest-level boot code in the firmware. If the firmware could speak file API or object API, you could boot from there... Which is a thing.
Netboot via PXE uses a file transfer protocol to download the bootloader (as opposed to a block storage protocol), so you can say file storage or object storage ARE capable of booting an OS if they can support that protocol.


A lot of confusion in the questions, comments, and answers comes from these storage types usually being stacked.

On Linux, both md and LVM implement block storage using other block storage. They do that by accepting a "write this block" request and translating it to another "write to this block" request to the correct disk.
You can also stack LVM on top of md on top of physical disks.

In fact, block storage API is the only thing that's economically simple enough to support in hardware, so effectively all storage is built on top of block storage.

ext4 is file storage implemented on top of block storage (your hard drive, or LVM). It decides on how files should look like on a block device based on how it's formatted (namely, how its skeleton data structures were written to the block storage), and then when it receives a file write request, it translates it to the appropriate "write this block" requests to the block storage.

WrapFS is file storage that uses another file storage rather than using block storage. Namely, when it receives a file write request, it translates it to another file write requests to the filesystem it's wrapping.

NFS is networked file storage implemented on top of local file storage implemented on top of local block storage. That is, it translates "write this file" requests to a different "write this file" RPC, and the server translates this RPC to a yet different "write this file" request to its local filesystem.

There are even loop devices, which implement block storage on top of file storage.

Many object stores are actually built on top of file stores that are built on top of block stores. Minio, for example, will take a regular filesystem, format it (namely, create the directory structure it needs), and then translate requests like "write this object" to "write into this file in the filesystem".

Likewise, Panasas' HPC cluster implements object storage on top of networked file storage (OSDFS).
Panasas also implements file storage on top of their object storage (translate file write request to object write request), which means it writes some skeleton data e.g. the root inode onto the object store (namely, it formats the object store).

I've seen a proprietary networked file stores that are implemented on top of proprietary local object storage that is implemented on top of networked file stores that are implemented on top of local block stores.

Unlookedfor answered 31/5, 2022 at 2:29 Comment(1)
This is one of the most complete answers that I've seen around here. Thank you very much @Unlookedfor stackoverflow.com/users/10678955/rootEnsheathe
W
1

According to this article ext4 a file system used to format block storage. You do not format object storage.

https://cloudacademy.com/blog/object-storage-block-storage/

Willock answered 1/3, 2022 at 12:10 Comment(2)
It doesn't say that ext4 is block storage, it says that storage devices may be formatted with a filesystem such as ext4. File system -> file storage.Carpous
Please read the article before giving negatives... "Block storage is the most commonly used storage type for most applications. It can be either locally or network-attached and are typically formatted with a file system like FAT32, NTFS, EXT3, and EXT4."Willock
G
0

Ext4 allocates storage space in units of "blocks". For more info you can enter "sudo fdisk -l" command in linux and check how many blocks/sectors are present in your disk.

sample output. Disk /dev/sdb: 447.1 GiB, 480103981056 bytes, 937703088 sectors

means 937703088 blocks with each 512 bytes, this way whole drive is divided.

Gideon answered 24/4, 2022 at 19:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.