当我总结我的文件的大小时,我得到一个数字。如果我跑du
,我会得到另一个数字。如果我du
在分区上的所有文件上运行,它与df
使用的声明不匹配。为什么我的文件总大小有这么多不同的数字?电脑不能加吗?
说到添加:当我添加 的“Used”和“Available”列时df
,我没有得到总数。而且这个总数小于我的分区大小。如果我把我的分区大小加起来,我就不会得到我的磁盘大小!是什么赋予了?
出于某种原因,当我在 OS X 上制作文本文件时,它总是至少 4kB,除非它是空白的。为什么是这样?1 字节的纯文本可能有 4,000 字节的元数据吗?
我通常认为这tar
是一个压缩实用程序,但我不确定它是否真的压缩文件,还是就像一个 ISO 文件,一个保存文件的文件?
我有一个从 WD Mybook Live NAS 中取出的 3TB 硬盘。分区表如下:
Model: ATA WDC WD30EZRS-11J (scsi)
Disk /dev/sdb: 3001GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Number Start End Size File system Name Flags
3 15.7MB 528MB 513MB primary
1 528MB 2576MB 2048MB ext3 primary raid
2 2576MB 4624MB 2048MB ext3 primary raid
4 4624MB 3001GB 2996GB ext4 primary
Run Code Online (Sandbox Code Playgroud)
所以我试图访问分区 4(最大的一个!):
root@john-desktop:~/linux-3.9-rc8# mount -t ext4 /dev/sdb4 /mnt/
mount: wrong fs type, bad option, bad superblock on /dev/sdb4,
missing codepage or helper program, or …
Run Code Online (Sandbox Code Playgroud) 如果我正确阅读了 ext4 文档,从 Linux 3.8 开始,对于非常小的文件,应该可以将数据直接存储在 inode 中。
我期望这样一个文件的大小为 0 块,但事实并非如此。
# creating a small file
printf "abcde" > small_file
# checking size of file in bytes
stat --printf='%s\n' small_file
5
# number of 512-byte blocks used by file
stat --printf='%b\n' small_file
8
Run Code Online (Sandbox Code Playgroud)
我希望这里的最后一个数字是 0。我错过了什么吗?
disk-usage ×2
ext4 ×2
filesystems ×2
linux ×2
compression ×1
kernel ×1
nas ×1
partition ×1
tar ×1