linux 缩小 dev sha空间,linux系统的blocksize

linux 中有以下几种blocksize:

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

可以通过 fdisk查看:

fdisk -l

Disk /dev/vda: 107.4 GB, 107374182400 bytes, 209715200 sectors

Units = sectors of 1 * 512 = 512 bytes

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

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

Disk label type: dos

Disk identifier: 0x000d7d2b

Device Boot Start End Blocks Id System

/dev/vda1 * 2048 20971519 10484736 83 Linux

/dev/vda2 20971520 209715199 94371840 83 Linux

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

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

sudo tune2fs -l /dev/vda2| grep Block

Block count: 23592960

Block size: 4096

Blocks per group: 32768

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

xfs_info /dev/vda1

meta-data=/dev/vda1 isize=256 agcount=4, agsize=655296 blks

= sectsz=512 attr=2, projid32bit=1

= crc=0 finobt=0

data = bsize=4096 blocks=2621184, imaxpct=25

= sunit=0 swidth=0 blks

naming =version 2 bsize=4096 ascii-ci=0 ftype=0

log =internal bsize=4096 blocks=2560, version=2

= sectsz=512 sunit=0 blks, lazy-count=1

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数:

[XXX@yfslcentos71 test]$ ll

-rwxrwxr-x 1 wangxiumin wangxiumin 15323 Aug 19 20:00 r

[XXX@yfslcentos71 test]$ du r

16r

[XXX@yfslcentos71 test]$ du -h r

16Kr

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值