问题描述
文件系统块大小的意义是什么?如果我的文件系统块大小被设置为8K,这是否意味着所有的读/写I / O都会发生在8K的大小?所以如果我的应用程序想要读取偏移4097处的16个字节,那么从偏移量4096开始的4K块将被读取?
在这种情况下写入是如何工作的?假设我想写64字节。 解决方案
文件系统块大小的意义是什么?如果我的文件系统块大小被设置为8K,这是否意味着所有的读/写I / O都会发生在8K的大小?所以如果我的应用程序想要读取偏移4097处的16个字节,那么从偏移量4096开始的4K块将被读取?
在这种情况下写入是如何工作的?假设我想写64字节。 解决方案
你是对的。块大小是文件系统的工作单元。每个读写都以块大小的整数倍完成。
块大小也是文件可以具有的最小磁盘大小。如果你有一个16字节的块大小,那么一个16字节大小的文件占用磁盘上的一个完整的块。
这本书指出:
What is the significance of the file system block size? If my Filesystem block size is set at say 8K does that mean that all read/write I/O will happen at size 8K? So if my application wants to read say 16 bytes at offset 4097 then a 4K block starting from offset 4096 will be read?
How do writes work in this case? Suppose I want to write say 64 bytes.
You are right. The block size is the unit of work for the file system. Every read and write is done in full multiples of the block size.
The block size is also the smallest size on disk a file can have. If you have a 16 byte Block size,then a file with 16 bytes size occupies a full block on disk.
The book "Practical file system design" states:
这篇关于文件系统块大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!