Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm copying over a bunch of files from an HFS+ volume to my Ext4 Ubuntu file system. They're all movie files. When I copy one over, it nearly always gets 4K larger. The copied file is exactly 4,096 bytes larger than the original.

I'm assuming this is because some metadata of some sort is being added, but what is it exactly?

Also, out of 600 files, two of them didn't grow in size. They're exactly the same. Why would this be?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

I don't know. But this is normal.

You can try to look at the files with du:

du -c *.mov
du -c --apparent-size *.mov

The first command will tell the Disk Usage (how much space is occupied on disk).

The second will show the actual size of the data (independent of where the file is stored).

share|improve this answer
    
Ah, fantastic. I skimmed over the apparent-size flag in the du man page. Very useful. Thank you. –  Kris Harper May 18 '11 at 5:20
add comment

I would guess that the two filesystems have different block sizes. A block is a storage unit that allows for some abstraction by the filesystem for tracking allocation of space. A single block is the minimum unit of storage; a filesystem that uses 4K blocks will use a 4K block to store a 1K file. More small blocks require more disk space for metadata. The optimal block size will vary depending upon the typical file size, the total capacity of the storage media, and the filesystem used. Modern filesystems will choose a reasonable block size, given the latter two factors; a sysadmin may tweak the block size or chooseb a filesystem given her expectations for the use of the filesystem.

So, the two filesystems may have different block sizes because the disks are different sizes, or because the two different file systems have different schemes for optimizing block sizes, most likely because of different handling of metadata. The two files that didn't take up an extra 4K may have been just small enough to take up one less block each.

share|improve this answer
    
Okay great. After Googling around, I've the block size on my system is 4K by running sudo dumpe2fs /dev/sdx | grep 'Block size'. Finding the block size for the HFS+ volume didn't work, but this chart indicates that on my 1GB drive it should be 2K. So, this doesn't make too much sense to me because the files increased by exactly one block, which would seem to indicate that they were a multiple of 4K to start. It would make more sense if they all increased by 2K. Regardless, Levchuk's comment has helped me confirm the sizes are the same. –  Kris Harper May 18 '11 at 5:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.