Re: Where are my bytes hiding?
Re: Where are my bytes hiding?
- Subject: Re: Where are my bytes hiding?
- From: "Stephen J. Butler" <email@hidden>
- Date: Thu, 05 May 2016 01:13:10 -0500
Those files are compressed by the filesystem. In HFS+/MacOS Extended that
means that the data fork is empty and the file contents are stored in the
resource fork or extended attributes structure.
http://wiki.sleuthkit.org/index.php?title=HFS#HFS.2B_File_Compression
If it's in the extended attributes, then it's part of the file metadata
(like name, timestamps, etc), whereas Finder is probably using the size of
the datafork to arrive at 0 bytes. If you get the afsctool (from MacPorts
for example) then you can get all sorts of detailed info:
File is HFS+ compressed.
File content type: public.xml
File size (uncompressed data fork; reported size by Mac OS 10.6+ Finder):
2005 bytes / 2 KB (kilobytes) / 2 KiB (kibibytes)
File size (compressed data fork - decmpfs xattr; reported size by Mac OS
10.0-10.5 Finder): 0 bytes / 0 KB (kilobytes) / 0 KiB (kibibytes)
File size (compressed data fork): 895 bytes / 1 KB (kilobytes) / 1 KiB
(kibibytes)
Compression savings: 55.4%
Number of extended attributes: 0
Total size of extended attribute data: 0 bytes
Approximate overhead of extended attributes: 268 bytes
Approximate total file size (compressed data fork + EA + EA overhead + file
overhead): 1411 bytes / 1 KB (kilobytes) / 1 KiB (kibibytes)
You might want to take a look at the source code of that tool to see how
they calculated all those numbers. Be careful of licensing though.
On Wed, May 4, 2016 at 11:47 PM, Gerriet M. Denkmann <email@hidden>
wrote:
> I just did:
> > cd
> /Applications/Xcode.app/Contents/Developer/Documentation/DocSets/com.apple.adc.documentation.watchOS.docset/Contents/Resources/Tokens/C/tag/-
> > ls -skl
>
> There are 8 files. Finder → File → Get Info → Size: has for each: xxx
> bytes (Zero bytes on disk), where “xxx” is the same number as reported by
> “ls -skl”.
>
> First question:
> How does one achieve this phenomenal compression: 0 bytes on disk - but
> can expand to several thousand bytes? If this is not a creatio ex nihilo,
> then: where are these bytes hiding?
>
> Second question:
> Finder says about the containing folder: 11,239 bytes (33 KB on disk) for
> 9 items
> 11,239 = sum of TotalFileSizes of the 8 files in this folder.
> But where do the “33 KB on disk” come from? 8 times “Zero bytes on disk”
> should be zero, shouldn’t it?
>
> The reason for these questions:
> I want to write an app, which counts (for a given folder) the number of
> bytes stored on disk.
>
> Gerriet.
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden