ale*_*ail 6 osx disk-usage hfs+
区别的解释是什么:
$ ls -l /Applications/Safari.app/Contents/Info.plist
-rw-r--r-- 1 root wheel 15730 11 jui 15:02 /Applications/Safari.app/Contents/Info.plist
$ du -sh /Applications/Safari.app/Contents/Info.plist
0B /Applications/Safari.app/Contents/Info.plist
Run Code Online (Sandbox Code Playgroud)
一旦文件被复制到我的主文件夹中,ls
并du
报告相同的数字。
$ cp /Applications/Safari.app/Contents/Info.plist .
$ du -sh Info.plist; ls -l Info.plist
16K Info.plist
-rw-r--r-- 1 ant staff 15730 17 oct 16:53 Info.plist
Run Code Online (Sandbox Code Playgroud)
两个目录都在这个分区 ( / )
diskutil info /
Device Identifier: disk0s2
Device Node: /dev/disk0s2
Part of Whole: disk0
Device / Media Name: ml2013
Volume Name: OSX.10.8
Escaped with Unicode: OSX.10.8
Mounted: Yes
Mount Point: /
Escaped with Unicode: /
File System Personality: Journaled HFS+
Type (Bundle): hfs
Name (User Visible): Mac OS Extended (Journaled)
Journal: Journal size 40960 KB at offset 0xc83000
Owners: Enabled
Run Code Online (Sandbox Code Playgroud)
这是 stat 的输出:
$ stat Info.plist
16777218 8780020 -rw-r--r-- 1 root wheel 0 15730 "Oct 17 17:47:12 2013" \
"Jun 11 15:02:17 2013" "Jun 11 15:02:17 2013" "Apr 27 11:49:34 2013"\
4096 0 0x20 Info.plist
Run Code Online (Sandbox Code Playgroud)
我可能发现了一些东西:
OS X 上的 ls 命令有这个开关:
-O Include the file flags in a long (-l) output.
Run Code Online (Sandbox Code Playgroud)
结果是:
$ ls -O Info.plist
-rw-r--r-- 1 root wheel compressed 15730 11 jui 15:02 Info.plist
Run Code Online (Sandbox Code Playgroud)
我刚刚检查(实验性地)du
总是报告0
HFS+ 压缩文件。
复制压缩文件解压缩它们;所以du
在复制的、未压缩的文件上逻辑地报告正确的文件。
在 Mac OS X 10.6 中,Apple 在 HFS+ 中引入了文件压缩。压缩最常用于作为 Mac OS X 一部分安装的文件;用户文件通常不压缩(但当然可以!)。就 Apple 的文件系统 API 而言,读取和写入压缩文件是透明的。
压缩文件有一个空的数据叉。这意味着不知道 HFS+ 文件压缩(包括 4.0.0 之前的 TSK)的取证工具将看不到与压缩文件相关的任何数据!
在Mac OS X and iOS Internals: To the Apple's Core
Jonathan Levin 的第 16 章:To B(-Tree) or not to be - HFS+ 文件系统中也有关于这个主题的讨论。
此外,afsctool可以帮助查看文件夹中压缩了哪些文件。
$ afsctool -v /Applications/Safari.app/
/Applications/Safari.app/.:
Number of HFS+ compressed files: 1538
Total number of files: 2247
Total number of folders: 144
Total number of items (number of files + number of folders): 2391
Folder size (uncompressed; reported size by Mac OS 10.6+ Finder): 29950329 bytes / 34.7 MB (megabytes) / 33.1 MiB (mebibytes)
Folder size (compressed - decmpfs xattr; reported size by Mac OS 10.0-10.5 Finder): 21287197 bytes / 23.8 MB (megabytes) / 22.7 MiB (mebibytes)
Folder size (compressed): 22694835 bytes / 25.2 MB (megabytes) / 24 MiB (mebibytes)
Compression savings: 24.2%
Approximate total folder size (files + file overhead + folder overhead): 26353338 bytes / 26.4 MB (megabytes) / 25.1 MiB (mebibytes)
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3158 次 |
最近记录: |