14

I've bought a 1TB external hard drive and after formatting the entire drive in ext4 Nautilus says there are 934.3 GB of free space. enter image description here

I've also tested formatting the drive in XFS, and in this case there are 999.7 GB of free space.enter image description here

Why more than 60 GB are missing from free space with ext4 and not with XFS ?

2 Answers 2

19

EXT3/EXT4 filesystems take 5% of partition size for security etc. (e.g. in "non free disk space disk" cause).

If it isn't root partition, You could change this 5% to e.g. 1% by doing:

sudo tune2fs -m 1 /dev/sda3

where you should change sda3 to your partition.

2
  • 4
    This space is not lost, by the way -- it is reserved for a single user, typically root. This is useful for example if you have a single partition and one user downloads the Internet (filling up the disk), system services can still write log files and audit information, keeping the system at least functional enough so an administrator can log in and examine the situation. For disks that will never contain anything relevant to the system, it is certainly acceptable to set this reservation to 0%. Jul 26, 2012 at 16:05
  • "If it isn't root partition"- Actually, it WILL work for root partition, and mounted partitions. Thx
    – Sepero
    Aug 17, 2013 at 11:46
9

With ext4 (and the extfs family) the inode tables are pre-allocated at format time. This is the traditional Unix behavior concerning file systems. When you format a volume with the extfs file system, you can tweak the number of inode you expect using the -N parameter of the mkfs utility. (Source).

This design may offer better performance (when allocating many files at a time) in spite of scalability. One has to estimate the number of inode needed at format time. A volume containing mostly small files, say a mail server, will require more inodes per gigabyte than a volume containing ISOs.

Once you used all the inodes you just can’t create new file even if there is still free space on the drive. The bigger the volume is, the larger the inode tables will be. That leads to many gigabytes lost on large drives.

On the other hand, XFS uses a technique called "dynamic inode allocation" (Source). This leads to better scalability as the number of inodes grows or shrinks depending on the amount of data on the volume. This is a better design when you can’t predict what the file system will be used for or when you expect to save the extra space for your data. This is also the NTFS behavior.

What has been said about journaling is wrong, journaling costs only a few megabytes. The main space loss is due to static inode allocation.

You must log in to answer this question.

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