3

I'm performing a new Ubuntu Server installation, on hardware RAID 10, 6 x 1.72TB SSD, total space to partition is 5.8TB. The server is going to be used for KVM virtualisation.

I've allocated 500MB for /boot ext4

2GB for swap

Leaving 5.8T for / ext4

At 5% reserved blocks for the / partition, this is 290GB of space that I would ideally like to be able to use.

Is 290GB of reserved blocks overkill? I have read up what it's used for, but i'm getting mixed opinions, some say it only needs to be as big as the larges file, others say it's required.

My gut feeling is that the good folks of the linux world know what they're doing and it's set to 5% for a reason, but i'd like to take opinions on this.

elliotp
  • 386
  • 1
  • 6
  • 18

2 Answers2

6

On ext* based filesystems, the reserved space is used to guarantee privileged processes (ie: syslog) some more space to use. Without this reservation (and not using quotas) an user-level process can immediately reclaim all space without any log to be written (due to lack of free blocks). Forcing some free blocks is also beneficial to reduce fragmentation; however, it has nothing to do with large files handling.

The 5% default reserved space was chosen back in the days when HDDs (and filesystems) were much smaller than today. For example, on a 2 GB HDDs reserving 40 MB (5%) for root/logs/debug was a sensible choice.

Nowadays, with TB-sized filesystems being the norm, it can be safely scaled back to, say, 1%

You can also set a specific, absolute value for the reserved space (expressed in filesystem blocks, generally 4 KB sized) via tune2fs -r

shodanshok
  • 44,038
  • 6
  • 98
  • 162
  • How to find number of blocks for a given X GB of desired reserved space/ – Freedo Nov 19 '21 at 02:34
  • @Freedo I am not sure to understand your question – shodanshok Nov 19 '21 at 06:38
  • If I want to reserve X gb of space, how do I Know how much blocks that is? – Freedo Nov 19 '21 at 06:41
  • 1
    With default block size (4K), you simply divide your expected reserved space (in KB) by 4. Then you can use `tune2fs -r` to specify the number of reserved blocks. But be aware than ext* filesystem supports multiple block sizes, so you should check `dumpe2fs` output if in doubt. – shodanshok Nov 19 '21 at 10:03
2

1% or so reserved for ext4, definitely. It is wasteful to go much bigger on a many TB volume.

Technically the file system reserve space is not related to the disk partitioning, as the file system is contained entirely within the partition.

There also are choices to be made about the partitioning. Personally, I prefer LVM, as you can allocate and extend and snapshot logical volumes online. You could have a 100 GB root mounted at / and a 4 TB data file system mounted at /var or wherever you have your data.

John Mahowald
  • 30,009
  • 1
  • 17
  • 32