I could not find more information and reading the code makes me think I'm running into a compatibility issues.

Here's the story: This is in a virtualized multi-tenant environment. We've been trying to find a way to nicely downsize virtual disks if the user doesn't need much space any more. Growing them is easy, but shrinking is really hard.

Today we thought we could just leverage overprovisioning the disks and leave the virtual disk as big as it was but implement a quota. That together with trimming would cause actual usage on the backend SAN to drop and thus effectively reflect the customer's usage.

XFS does have a feature to implement a per-directory quota (which we'll try to enable for / to get what we want). ext4 has quotas only on a per-user or per-group basis so that won't work.

Enter: reserved blocks. Those are intended to leave some space free for root (or rather some specified user/group) in the case that a machine reaches a "disk full" scenario.

I toyed around with it, but I could never trigger it: even if I set the reserved block count to 50% of the disk (through tune2fs), I was able as a regular user to consume much much more (even actually fill the disk).

What I found surprising is that looking at the data that tune2fs -l reported, was that half of the disk was unused. The internet says that this number is not reliable as an online report, so, well. (Interestingly this number even didn't change after a clean reboot.)

I started reading around kernel options and the actual ext4 code that is in our environment and I stumbled over a code path that indicates that using the delayed block allocator might not trigger the checks for block reservations.

As it's hard to find anything reliable on this, here's more specific questions:

  • Is the feature intended to still work at all?
  • Would it make a good replacement for a disk-wide quota?
  • Am I running into compatibility issues where reserved blocks may (undocumentedly) not be used together with other features (like maybe the delayed block allocator)?
  • It is easy to shrink an ext4 filesystem using resize2fs. Are you using VMware vSphere? – fpmurphy Mar 9 '16 at 18:36
  • I know about the shrinking. But that's an offline operation and actually it requires intricate knowledge about the VMs internal partition structure, etc. We've been running into complicated issues again and again why that doesn't work reliably. We're using Qemu/KVM. – Theuni Mar 9 '16 at 18:54
  • Ah, so you are looking for some way to do online shrinking of fileystems/volumes/luns? – fpmurphy Mar 10 '16 at 8:44
  • Quick testing here shows that reserved blocks is working, kinda - but I think that this topic would be an excellent question for the ext4 mailing list. – ckujau Mar 10 '16 at 9:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.