代码改变世界

Linux查看系统块大小

2020-04-23 22:41  潇湘隐者  阅读(15790)  评论(0编辑  收藏  举报

Linux系统的块大小(Block Size)怎么查看呢?下面总结一些常用的查看块大小(block size)的方法。

 

方法1: fdisk -l查看block size

 

 

[root@KerryDB ~]# fdisk -l /dev/sda1

 

Disk /dev/sda1: 106 MB, 106896384 bytes, 208782 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 4096 bytes

I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Alignment offset: 512 bytes

 

方法2:stat命令查看block size

 

[root@KerryDB ~]# stat / | grep "IO Block"
  Size: 260             Blocks: 0          IO Block: 4096   directory
 
[root@KerryDB ~]# stat -f /
  File: "/"
    ID: fd0000000000 Namelen: 255     Type: xfs
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 13100800   Free: 11998605   Available: 11998605
Inodes: Total: 26214400   Free: 26170926

 

 

 

方法3:tune2fs命令查看block size

 

[root@mylnx ~]# tune2fs -l /dev/sda1 | grep "Block size"
Block size:               1024

 

这里可以是/dev/sda1, 对于LVM文件系统,可以使用下面命令

 

# tune2fs -l /dev/mapper/VolGroup04-LogVol00 | grep -i 'block size'
Block size:               4096

 

方法4:blockdev命令查看block size

 

[root@KerryDB ~]# blockdev --getbsz /dev/sda2
4096