简体   繁体   中英

Does a file system “see” the storage device as a (very large) byte array?

I want to know how does a file system write to and read from a storage device.

I think this is how it works:

A file system doesn't access the storage device directly, but rather the storage device is presented (by the device driver of the storage device) to the file system as a (very large) byte array.

For example, if the file system wants to access a hard disk, it will simply access the byte array representing the hard disk.

This way a file system can work with any type of storage device (traditional hard disk, SSD, USB flash drive, etc.), and only the device driver for the storage device is changed.

This image shows what I have just explained:

在此输入图像描述

Am I correct in my understanding?

Your understanding will be closer to truth if you just change "byte array" to "block array".

Both the file system drivers and the device drivers "see" underlying devices as arrays of blocks. HDDs manufactured between 1980~2010 have classic physical block (=sector) size equal to 512 bytes. In 2010 AF (=Advanced Format) appeared and physical sector (=block) size increased to 4096 bytes, but only for some models.

Disc geometry addressing (CHS=cylinder-head-sector) was declared as obsolete in 2002 when LBA-48bit was introduced. Logical Block Addressing (LBA) is simple scheme to reach block (=sector) by specifying its sequential number from 0 to (2^48-1) in case of LBA48.

For example, before 2002 computers and storages were based on LBA-28bit, which gives maximum storage size:
(512 * 2^28) = (2^9 * 2^28) = 2^37 = 2^7 Gb = 128 Gb.

Maximum size of LBA48 storage having sector size of 512 bytes:
(512 * 2^48) = (2^9 * 2^28) = 2^57 = 2^17 Tb = 131072 Tb = 128 petabyte.

Maximum size of LBA48 storage having sector size of 4096 bytes:
(4096 * 2^48) = (2^12 * 2^48) = 2^60 = 2^20 Tb = 1048576 Tb = 1024 petabyte.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM