1

I have 3 partitions -

/ - This has something close to 200 GB (more than anything else I might need in near or far future)

swap - 2 GB

/home - 200 GB /data - 500 GB (all those movies)

Now unlike MS-Windows where you need to have something close to 10 GB on the root partition (i.e. C:/) as it needs to all its house-keeping there, on Unix is there a need to keep anything more than 1 GB free ?

In other words, would have more free space under /home improve performance in any way ?

Am on ext4 -

 [$] sudo dumpe2fs -h /dev/sda7 | grep -e ^Reserved -e ^Block

[sudo] password for shirish: 
dumpe2fs 1.43.3 (04-Sep-2016)
Block count:              24413696
Reserved block count:     1220684
Block size:               4096
Reserved GDT blocks:      1018
Blocks per group:         32768
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
shirish
  • 12,356

3 Answers3

3

This depends on the file system in use.

With ext4, the traditional and still fairly common file system which derives originally from ext2 (and which it is backwards compatible with to some extent), the kernel will scatter files all over the hard disk to avoid fragmentation of files. To do that, however, requires some free space on the block device that contains the file system. If the amount of available disk space is very low, then the kernel cannot organize files in an efficient way, and fragmentation will occur (and, with it, performance issues).

This is the reason why the ext* file systems, by default, allocate 5% of their available space for root-only use. While it's possible to modify that, it's not recommended to do so, for obvious reasons. However, even if you don't make that modification and end up writing to the disk until you've used up all 95% of available disk space, performance may still suffer if that situation remains as is for a long time, especially if you're almost out of space and then start writing a large file to the partition.

The short version is that yes, it may cause performance issues when accessing that file system, but there's a built-in safety setting that should prevent the worst of those.

Other file systems have different features in this area, and may or may not suffer from the same problems; e.g., ZFS uses copy-on-write semantics, so it can reoptimise where it stores actual data every time it writes a new block. If you don't know what file system you're using, however, you're most likely using ext4, and the above applies.

2

Yes, it's always preferable to have some free space (say 5%) else your system performances may drop due to filesystem fragmentation (on mechanical hard drives) which causes your disk heads to go back and forth to read a file (which is much slower than reading a contiguous file).

See Does hard drive space affect performance? on ServerFault.

[update]

Note that on Linux ext2/3/4 filesystems, a small percentage of blocks are reserved for root. They also keep your system from being too fragmented (see Reserved space for root on a filesystem - why? for more details). You can see the amount of reserved blocks on an ext filesystem with the following command:

dumpe2fs -h /dev/sdxN | grep ^Reserved
xhienne
  • 17,793
  • 2
  • 53
  • 69
  • have updated with the command you shared, for some reason it didn't show in MB or GB but in bytes, can the command be updated to show it in MB or GB si units ? – shirish Dec 20 '16 at 17:51
  • The number given is a number of blocks. The total size depends on the block size (usually 4k). You can see it if you change my command this way: dumpe2fs -h /dev/sdxN | grep -e ^Reserved -e ^Block – xhienne Dec 20 '16 at 18:02
  • done, see the updated command in the question itself. I am guessing to know/get the final figure I just need to multiple 4096x number of reserved blocks to know how much space is being currently used, there isn't any way to get that number automatically. – shirish Dec 20 '16 at 18:55
0

It depends on what you are using your system for. For a mail server or web server I'd want more free space in /var. For a desktop system, I typically put /home on a software RAID-1 array, and I keep plenty of free space on / so I can dump large stuff that is somewhat expendable (distro isos downloaded, various temporary use vms, etc).

Basically, what parts of your directory tree will stay pretty static after initial install/configuration, and which will grow/shrink/see lots of usage?

ivanivan
  • 4,955
  • using it as a typical desktop system, single hdd (hence no RAID) , /home/$username does see lots of usage. Do take backups now and then. – shirish Dec 20 '16 at 20:42