有个快存满了的 1T 移动硬盘
du -h 的时候显示 921.2G 可是 du 的时候显示 1931852288
怎么数也对不上啊?咋回事?
du -h 的时候显示 921.2G 可是 du 的时候显示 1931852288
怎么数也对不上啊?咋回事?
1
kokutou Apr 17, 2022 via Android
有硬链接?
|
2
alect Apr 17, 2022
df -h
|
3
azev OP @alect
df -h /dev/sda1 931.5G 921.3G 10.2G 99% /var/media/onet df /dev/sda1 976761540 966092840 10668700 99% /var/media/onet |
4
iBugOne Apr 17, 2022 via Android
看 man ,du 的默认输出单位是 sector ,也就是 512 字节,1931852288 乘以 512 字节的结果没啥问题
|
6
ynyounuo Apr 18, 2022
@azev Posix compliant 的单位是 512 bytes ,所以 GNU du 设置了 POSIXLY_CORRECT=1 的话就会用 512 bytes ,BSD du 也一般是 default to 512 bytes
> The use of 512-byte units is historical practice and maintains compatibility with ls and other utilities in this volume of POSIX.1-2017. This does not mandate that the file system itself be based on 512-byte blocks. https://pubs.opengroup.org/onlinepubs/9699919799/utilities/du.html#RATIONALE |