2

I'm running Darwin (Mac OS X 10.11.2 - the current version of El Capitan) on my Mac Book Pro, but this is about a standard command line utility, du.

I am getting inconsistent results from du:

21:19 % du -sk
677876  .
21:19 % du -sk .
677876  .
21:19 % du -sk *
276464  aaa
61440   bbb
339968  ccc
21:19 % du -sk * .
276464  aaa
61440   bbb
339968  ccc
4   .

All normal so far - here comes the surprise

21:19 % du -sk . *
677876  .
0   aaa
0   bbb
0   ccc

I don't expect to know why it is doing this - but how do I find out why it is doing this?

A comment asked for the output of ls -l and that's a great suggestion. Here is the output of ls -lai@:

total 7
 19867848 drwxr-xr-x@ 6 root  wheel  204 Feb  9 21:09 .
    com.apple.backupd.SnapshotVolumeFSEventStoreUUID     36 
    com.apple.backupd.SnapshotVolumeLastFSEventID     8 
    com.apple.backupd.SnapshotVolumeUUID     36 
 19867847 drwxr-xr-x@ 3 root  wheel  102 Jun 19  2014 ..
    com.apple.backup.SnapshotNumber   2 
    com.apple.backup.SnapshotVersion      1 
    com.apple.backupd.SnapshotCompletionDate     16 
    com.apple.backupd.SnapshotStartDate  16 
    com.apple.backupd.SnapshotType    1 
    com.apple.backupdelta.IsMobileBackup      3 
    com.apple.backupdelta.SizeEstimate    9 
 19868010 drwxr-xr-x@ 3 root  wheel  102 Dec 21 08:24 aaa
    com.apple.s stem.Security    68 
 19867861 drwxr-xr-x@ 3 root  admin  102 Jan 27  2014 bbb
    com.apple.backupdelta.MoveChecked     3 
 19871640 drwxr-xr-x@ 3 root  wheel  102 Jun 19  2014 ccc
    com.apple.FinderInfo     32 
2
  • 1
    can you post ls -la? wonder if that has something to do with rights or something Feb 10, 2016 at 5:09
  • @aaaaaa: Question edited with answer
    – D Mac
    Feb 10, 2016 at 17:06

1 Answer 1

1

I think your using du in a Time Machine backup folder.

Per du man page:

Directories having multiple hard links (typically Time Machine backups) are counted a single time per du execution.

So I think the aaa, bbb and ccc files are hard links, and since they were counted in the result of the ., they won't be counted again in the result for aaa, bbb or ccc. That's also why the output of du -sk * . doesn't show 677876, but only 4; the total of all the specified files/folders can't go over 677876.

Ref: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/du.1.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .