Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been moving a large number of files between a Linux system (ext3) and Mac OS X (HFS) and have noticed the slight variation in how the file size is reported by the ls command.

Having done some digging round the man pages I'm guessing this difference has to do with how the actual data is stored on the disk, and/or how the ls command on each system is looking at the size (i.e. disk usage, blocks used, etc.).

However, I'm still confused and wondering if there is a simpler answer to the different file sizes between the two systems. Is this a difference in the ls command, or in the filesystems? etc.

share|improve this question
After expanding any shell aliases, what options are you using? What part of the output of ls are you checking? The “total” line from ls -l might be different if the filesystems use different block/fragment sizes. If the size in bytes (usually between user/group and date) of a file is different, then you likely have a bad copy. Run md5/sha1/openssl md5/openssl sha1 on one of the files that shows a difference on each side. If those tools report different hash values then your copy is bogus. – Chris Johnsen Nov 10 '09 at 21:59

Likely it's the file system. The command is probably reporting a value as the size on disk rather than the actual size, and since each machine may be using a different cluster size, you see different values. More on the topic in this question.

You can use tune2fs -l to see how your file system is currently configured.

share|improve this answer

Which version of OSX are you running? Snow Leopard now uses base-10 calculations instead of base-2. If you're on 10.5 or older, I would attribute it to filesystems. Try comparing filesizes from a FAT32 thumbdrive.

share|improve this answer
Mac OS X 10.6 still uses base 2 in most of the command line commands including ls. – Chealion Nov 10 '09 at 18:40

You must log in to answer this question.

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