OSX tar: restored files larger on disk

Discussion in 'Mac OS X Lion (10.7)' started by greno, May 6, 2012.

  1. greno macrumors newbie

    Joined:
    May 3, 2012
    #1
    Can someone please explain why OSX bsdtar and gnutar are creating restored files larger on disk than when they were archived?

    Here's an example:

    Code:
    Mes-Mac-mini:test root# gnutar -czf /tmp/XPC-MacOS.tgz -C / System/Library/XPCServices//com.apple.cmio.registerassistantservice.xpc/Contents/MacOS 
    Mes-Mac-mini:test root# gnutar -xzf /tmp/XPC-MacOS.tgz 
    Mes-Mac-mini:test root# 
    Mes-Mac-mini:test root# du -sh System/Library/XPCServices//com.apple.cmio.registerassistantservice.xpc/Contents/MacOS
     52K    System/Library/XPCServices//com.apple.cmio.registerassistantservice.xpc/Contents/MacOS
    Mes-Mac-mini:test root# 
    Mes-Mac-mini:test root# du -sh /System/Library/XPCServices//com.apple.cmio.registerassistantservice.xpc/Contents/MacOS
     12K	/System/Library/XPCServices//com.apple.cmio.registerassistantservice.xpc/Contents/MacOS
    Mes-Mac-mini:test root# 
    Mes-Mac-mini:test root# 
    Mes-Mac-mini:test root# ls -la System/Library/XPCServices//com.apple.cmio.registerassistantservice.xpc/Contents/MacOS
    total 104
    drwxr-xr-x  3 root  wheel    102 Jul 31  2011 .
    drwxr-xr-x  3 root  wheel    102 May  6 16:17 ..
    -rwxr-xr-x  1 root  wheel  50464 Feb 20 15:42 com.apple.cmio.registerassistantservice
    Mes-Mac-mini:test root# ls -la /System/Library/XPCServices//com.apple.cmio.registerassistantservice.xpc/Contents/MacOS
    total 24
    drwxr-xr-x  3 root  wheel    102 Jul 31  2011 .
    drwxr-xr-x  7 root  wheel    238 Jul 31  2011 ..
    -rwxr-xr-x  1 root  wheel  50464 Feb 20 15:42 com.apple.cmio.registerassistantservice
    Mes-Mac-mini:test root#
    As you can see the restored files from the OSX gnutar archive take up nearly 4.5 times as much room on disk, 52K v 12K.

    OSX bsdtar suffers from the same problem.

    What is causing this?

    .
     
  2. greno thread starter macrumors newbie

    Joined:
    May 3, 2012
    #2
    The answer is that the files under /System are being compressed in newer versions of HFS+. And when you archive and extract them again then they become uncompressed and therefore larger on disk.

    .
     

Share This Page