0
$\begingroup$

Data is read in terms of a block from a storage device(magnetic, optical, flash). Size of the block depends upon the filesystem and os. The physical device may have different units of storage like sectors.

Do filesystems create the abstraction layer directly over the physical device, or do they work over something called as a block device?

If they work over the block device then does it mean that when we create a partition table(gpt, msdos, mac) then block device abstraction is created and filesystems(fat, ntfs, ext) are then created for partitions of the device over the block device layer?

$\endgroup$
  • 1
    $\begingroup$ What would be the determining difference between what you would call a "physical device" vs what you would call a "block device"? $\endgroup$ – D.W. Jun 24 '17 at 15:13
  • $\begingroup$ Block device is an OS abstraction that it uses to move data in blocks and presents a uniform view of the storage device whether it is a magnetic, flash or any other technology. Physical device or raw device is the actual storage structure with its physical level reading and writing mechanisms controlled by its device controller. See this $\endgroup$ – gamedev90 Jun 26 '17 at 11:48
1
$\begingroup$

You usually have several layers. You will have a physical level, where complete sectors can be read or written - except on SSD drives, you can only write into an area that is zeroed, and you can only zero sectors 32 or 64 at a time. Much more interesting than a hard drive.

On top of that you have a level that is still in the hard drive. Caches on a hard drive, highly complex controllers on an SSD drive. SSD drives especially need to be handled right to get maximum performance, and that is built into the controller instead of the operating system.

On top of that you usually have one level handling partitioning, possibly one level handle fusioning of partitions on several drives, and a level handling full disk encryption. And you'll build your file system on the highest of those levels.

$\endgroup$
0
$\begingroup$

Some physical devices are already block devices: they move data in blocks and present a uniform view of the storage as a bunch of blocks. For instance, hard drives and SSDs basically provide a block device abstraction: they let you read or write a block (sector) at a time. Filesystems are responsible for organizing the data and storing it on the storage device, by using the block-level operations provided by the storage device.

Partition tables are a way to store multiple filesystems on a single storage device. They're not really about creating a block device abstraction; they're orthogonal to the issues you're asking about.

The link you gave in a comment is not very helpful for understanding the answer to this particular question.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.