关于linux文件Blocks和Block size的一些解析
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash
免费下载资源
·
File system block sizes
On the other hand, every file system needs to split up a partition into blocks to store files and file parts. This is why there is a different block size for a file system as you can see here:
tweedleburg:/mnt/sdb2 # stat -f . File: "." ID: 236d62321492c2ce Namelen: 255 Type: ext2/ext3 Block size: 4096 Fundamental block size: 4096 Blocks: Total: 76899893 Free: 8380419 Available: 4474114 Inodes: Total: 39075840 Free: 38013010
So, if you store a file in this file system, it will be stored in a 4096-byte-block, that means, even if your file only contains 5 bytes, it will take away 4096 bytes from your disk's capacity:
tweedleburg:/mnt/sdb2 # df . Filesystem 1K-blocks Used Available Use% Mounted on /dev/sdb2 307599572 274077896 17896456 94% /mnt/sdb2 tweedleburg:/mnt/sdb2 # echo hallo>welt tweedleburg:/mnt/sdb2 # df . Filesystem 1K-blocks Used Available Use% Mounted on /dev/sdb2 307599572 274077900 17896452 94% /mnt/sdb2 tweedleburg:/mnt/sdb2 # du -csh welt 4.0K welt 4.0K total
摘自:http://wiki.linuxquestions.org/wiki/Block_devices_and_block_sizes
小结:
1. stat命令输出的Blocks单位通常是512bytes,也就是一个扇区。
2. 一个文件假设只有几个字节,其实也会占用一个文件块(Block size)大小,通常是4096bytes。
3. 系统通常一次会读取一个Block size大小,而不是一个扇区大小。
原文出自:http://blog.csdn.net/daiyudong2020/article/details/53897775
End;
GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e
added ecosystem file for PM2 4 年前
5def40a3
Add host customization support for the NodeJS version 4 年前
更多推荐
已为社区贡献13条内容
所有评论(0)