How much space should you leave free on a hard disk? [closed]

Is there a rule of thumb for how much space to leave free on a hard disk? I used to hear you should leave at least 5% free to avoid fragmentation.

[I know the answer depends on usage (eg: video files vs text), size of disk, RAID level, disk format, disk size - but as it's impractical to ask 100 variations of the same question, any information is wlecome]


Solution 1:

You generally want to leave about 10% free to avoid fragmentation, but there is a catch. Linux, by default, will reserve 5% of the disk for the root user. When you use 'df', the output doesn't include that 5% if you run it as a non-root user. Just something to keep in mind when doing your calulations.

Incidentally, you can change the root reserve by using tune2fs. For example

tune2fs -m 2 /dev/hda1

will set the root reserve at 2%. Generally this is not recommended of course, unless you have a very specific purpose in mind.

Solution 2:

I would recommend 10% plus on Windows because defrag won't run if there is not about that much free on the drive when you run it. Leaving free space however will not necessarily stop fragmentation from occuring. As you already mentioned it is dependent on the usage. Fragmentation is caused more based on the amount of variance to the data on the drive and the size of the files being written and removed. The more the data changes and the more random the file sizes the more chance you have of fragmentation occurring.

The only real way to minimise fragmentation would be to defragment the drive on a regular basis manually or use a tool like Diskeeper which runs in the background on Windows cleaning up when the machine is idle. There are filesystems where fragmentation is handled by the OS in the background so manually running a defragmentation is not necessary.