2

I recently set up an NFS server on my Ubuntu server and I'm currently in the process of migrating my files from HFS+ HDDs to ext4. I've run into a problem however where the receiving disk (ext4 format) is running out of space before the transfer is complete. Both drives are 2 TB external USB drives and the receiving drive was newly formatted so there shouldn't have been anything on it.

I'm aware that the default block size for ext4 is 4K and, as expected, comparing

du /media/[Receiving Drive]/*
du --apparent-size /media/[Receiving Drive]/*

Shows that most (if not all) files are using an additional 4K on the disk. The HFS+ drive, which I've unfortunately already formatted to ext4 so I won't be able to get any info on, had a little over 12 GB of free space however based on current usage of the ext4 disk and the amount of files I've already transferred over, I'm missing over 200 GB of space!

I have absolutely no idea where this discrepancy is coming from because at most the addition of 4K to every single file would be significantly less than 1 GB, much less 200.

Both drives are now formatted as ext4 with a GUID Partition Table and diskutility shows that there's a ~700MB difference in capacity between them (another mystery).

Suffice it to say, I'm stuck. Any suggestions?

1 Answer 1

1

With the default settings, ext4 allocates one inode per 16,386 bytes, and an inode is 256 bytes, so on a 2 TB disk, that uses ~32 GB for the inode tables. You can reduce this when you format with the -T largefile option given to mkfs.ext4, but if you have lots of small files, you may run out of inodes and be unable to create any more, even though there is free space. Unless most of your files are less than half a meg or so though, this shouldn't be a problem.

The other thing is that by default, 5% of the space is reserved, and can not be invaded by normal users. On your 2 TB drive that amounts to 100 GB. You can disable this with sudo tune2fs /dev/sdXX -m 0 ( where /dev/sdXX is the drive/partition in question ), but it is generally not a good idea to fill a drive up above 95% anyhow as it tends to cause fragmentation.

3
  • Thanks, the majority of the files on this drive are over 1 GB so I'll reformat and use the largefile option.
    – RVanS
    Commented Feb 14, 2014 at 23:10
  • @RVanS, if that is the case then you might want to go for the largefile4 option, which allocates even fewer inodes ( 1 per 4 MB instead of 1 MB ).
    – psusi
    Commented Feb 14, 2014 at 23:37
  • Worked. I was able to fit all the files on the single drive. Thanks. I guess I should probably make it a habit to read the entire man page.
    – RVanS
    Commented Feb 16, 2014 at 22:22

You must log in to answer this question.

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