当前位置:   article > 正文

linux系统的blocksize

linux block size

linux 中有以下几种blocksize:

1.     硬件上的 block size, 应该是"sector size",扇区大小

可以通过 fdisk查看:

  1. fdisk -l
  2. Disk /dev/vda: 107.4 GB, 107374182400 bytes, 209715200 sectors
  3. Units = sectors of 1 * 512 = 512 bytes
  4. Sector size (logical/physical): 512 bytes / 512 bytes
  5. I/O size (minimum/optimal): 512 bytes / 512 bytes
  6. Disk label type: dos
  7. Disk identifier: 0x000d7d2b
  8. Device Boot Start End Blocks Id System
  9. /dev/vda1 * 2048 20971519 10484736 83 Linux
  10. /dev/vda2 20971520 209715199 94371840 83 Linux


2.     有文件系统的分区的block size, 是"block size",大小不一,可以用工具查看

比如:ext4文件系统,可以通过命令tune2fs -l 查看 blocksize:

  1. sudo tune2fs -l /dev/vda2| grep Block
  2. Block count: 23592960
  3. Block size: 4096
  4. Blocks per group: 32768

xfs文件系统,可以通过命令xfs_info 查看 blocksize

  1. xfs_info /dev/vda1
  2. meta-data=/dev/vda1 isize=256 agcount=4, agsize=655296 blks
  3. = sectsz=512 attr=2, projid32bit=1
  4. = crc=0 finobt=0
  5. data = bsize=4096 blocks=2621184, imaxpct=25
  6. = sunit=0 swidth=0 blks
  7. naming =version 2 bsize=4096 ascii-ci=0 ftype=0
  8. log =internal bsize=4096 blocks=2560, version=2
  9. = sectsz=512 sunit=0 blks, lazy-count=1
  10. realtime =none extsz=4096 blocks=0, rtextents=0


3.     Kernel buffer cache 的block size, 就是"block size":

The block size is the size of the buffers that the kernel uses internally when it caches sectors that have been read from storage devices (hence the name "block device"). Since this is the mostprimitive form of storage in the kernel, all filesystem cluster sizesmust be multiples of this. This block size is also what is almostalways referred to by userspace programs. For example, when you run"du" without the -h or -H options, it will return how many of theseblocks a file takes up. df will also report sizes in these blocks, the"Blocks" column in the fdisk -l output is of this type, and so on. Itis what is most commonly referred to as a "block". Two disk sectors fitinto each block.

命令du 显示的就是 block数:

  1. [XXX@yfslcentos71 test]$ ll
  2. -rwxrwxr-x 1 wangxiumin wangxiumin 15323 Aug 19 20:00 r
  3. [XXX@yfslcentos71 test]$ du r
  4. 16 r
  5. [XXX@yfslcentos71 test]$ du -h r
  6. 16K r


4.     磁盘分区的"cylinder size"。

转载于:https://my.oschina.net/ashnah/blog/1930428

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/343360
推荐阅读
相关标签
  

闽ICP备14008679号