By default, Ext 3 & 4 filesystems reserve 5% of available disk space for special processes (root user, syslog, fragmentation avoidance, etc.). On big partitions, it amount to quite a lot of lost space. This howto describe how to get back this disk space.

This howto is tested on:

  • Debian 5.0 Lenny
  • Debian 6.0 Squeeze
  • Ubuntu 11.04 Natty Narwhal
  • Debian 10.0 Buster


This change can affect the system’s performances. Removing reserved disks space augment fragmentation risks and can result of system crash when no more disk space is available.

Apply this manipulation on non critical systems only.


Choose the partition for which reserved disk space will be removed.


Set the new reserved blocks percentage (here, 1% in stead of the default 5%):



Detect if sudo is available (“command” is used if not):

command type -f 'sudo' &>'/dev/null' && cmdProxy='sudo'

Detect the filesystem block size:

blockSize="$(${cmdProxy} dumpe2fs "${partition}" 2>'/dev/null' \
  | command grep "Block size" \
  | command sed -e 's/.* //')"

Detect the current number of reserved blocks:

currentReservedBlockCount="$(${cmdProxy} dumpe2fs "${partition}" 2>'/dev/null' \
  | command grep "Reserved block count" \
  | command sed -e 's/.* //')"

Free the reserved blocks:

${cmdProxy} tune2fs -m "${reservedBlocksPercentage}" "${partition}"

Detect the new number of reserved blocks:

newReservedBlockCount="$(${cmdProxy} dumpe2fs "${partition}" 2>'/dev/null' \
   | command grep "Reserved block count" \
   | command sed -e 's/.* //')"

Compute the freed disk space (in Mega bytes):

freedBlockCount="$(( ${currentReservedBlockCount} - ${newReservedBlockCount} ))"
echo "Freed block count: ${freedBlockCount}
Freed disk space:  $(( ( ${freedBlockCount} * ${blockSize} ) / 1000000)) Mb"


  • Thanks to Termitor on #ubuntu-fr IRC channel for this trick.
Categories: Setup


Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.