Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

greno

macrumors newbie
Original poster
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?

.
 
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.

.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.