Results 1 to 9 of 9

Thread: Ext3/ext4 reserved blocks

  1. #1

    Default Ext3/ext4 reserved blocks

    Hello all,

    I recently did a fresh install of openSUSE 11.3 without formatting my home partition. When it was done I installed some applications and decided to clean up my home partition.

    I began with ~35GiB out of ~240GiB and when I was finished it was ~27GiB.
    But when I tried to find the source I discovered that my home partition was only filled with ~15GiB of files.
    So where did the other 12GiB gone?

    After some searching I discovered that every ext2/ext3/ext4 partition reserves 5% of the partition size by default. (240GiB / 100 * 5 = 12GiB Found them!)
    You can easily reduce this amount with this command:
    Code:
    tune2fs -r 0 /dev/sdxX
    I've still got some questions left:
    Where is this space needed for?, I've read things like the:

    • System uses it as some sort swap.
    • It is used for defragmentation.

    Is this space needed on a data partition? (If it's for defragmentation the answer would be no, but recommended)
    Is 5% really needed? (For partition greater than 512GiB the reserved space is way too much, ~25,6GiB)

    I'd also like to hear what you've done/heard about reserved blocks.

    Thanks in advance!
    Where did I put my coffee cup?
    dir -R /home/* | grep "coffee cup"

  2. #2
    Join Date
    Jul 2009
    Location
    Montreal, Québec
    Posts
    833

    Default Re : Ext3/ext4 reserved blocks

    Wow! This is really interesting and never heard of that and never noticed that. I'll go see right away.

    I am eager to know why is that.

  3. #3

    Default Re: Re : Ext3/ext4 reserved blocks

    Hello DaaX,

    Quote Originally Posted by DaaX
    Wow! This is really interesting and never heard of that and never noticed that. I'll go see right away.

    I am eager to know why is that.
    Still not sure where it's exactly for but I found this:
    Quote Originally Posted by Theodore Tso
    If you set the reserved block count to zero, it won't affect
    performance much except if you run for long periods of time (with lots
    of file creates and deletes) while the filesystem is almost full
    (i.e., say above 95%), at which point you'll be subject to
    fragmentation problems. Ext4's multi-block allocator is much more
    fragmentation resistant, because it tries much harder to find
    contiguous blocks, so even if you don't enable the other ext4
    features, you'll see better results simply mounting an ext3 filesystem
    using ext4 before the filesystem gets completely full.

    If you are just using the filesystem for long-term archive, where
    files aren't changing very often (i.e., a huge mp3 or video store), it
    obviously won't matter.
    Source: Reserved block count for Large Filesystem - Linux Archive

    Still searching for more information!
    Where did I put my coffee cup?
    dir -R /home/* | grep "coffee cup"

  4. #4
    Join Date
    Jun 2008
    Location
    Earth - Denmark
    Posts
    10,730

    Default Re: Ext3/ext4 reserved blocks

    linux (in face, all *nix) goes crazy if it runs out of space...among
    other things you can't even log in to fix the out of space problem
    _until_ there is space..

    the 5% is reserved for roots use only....so root can log in and fix
    the out of space problem..

    sure, you can reduce below 5%, but why? drives space is cheap, get
    more...and KEEP your 5% insurance that you won't lock yourself out..


    --
    DenverD
    CAVEAT: http://is.gd/bpoMD
    [NNTP posted w/openSUSE 11.3, KDE4.5.5, Thunderbird3.0.11, nVidia
    173.14.28 3D, Athlon 64 3000+]
    "It is far easier to read, understand and follow the instructions than
    to undo the problems caused by not." DD 23 Jan 11

  5. #5
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    22,191

    Default Re: Re : Ext3/ext4 reserved blocks

    This is espcialy important for what you could call "system disks". Just take the root partition / as the most important example for us normal Linux PC users. When this partition becomes "full", the users can not create any file anymore, But all root processes still can in that "reserved space". This means that e.g. logging and other important processes can cary on and thus the system will not break down immediatly. The system manager then has a bit of time to search for the problem and cure it (by e.g. removing ol log files, but it depends on what the problem is).

    For "user only"" file systems (like /home) this is not an important argument. But it could be argued that on a file system that is on the brink of being full, only scattered small pieces of disk are available and thus new files will be spread all over the disk and thus can be bad for performace. On the other hand, with todays large disks, 5% may be a lot of GBs.
    Thus one could argue setting this to e.g. 1% on big user only file systems. Or even to 0%.
    Henk van Velden

  6. #6
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: Re : Ext3/ext4 reserved blocks

    It's for performance reasons as Tso has explained.

    Bear in mind that while X GB or whatever sounds like a lot of space, by the time you get to 95% full, you'll be looking for new disk drive anyway and that extra space gained will only buy you a month or two more of usage which at the costs of disk drives these days, will only be a few bucks worth.

    But of course by all means lower the reserved block percentage on seldom changing partitions.

  7. #7

    Default Re: Re : Ext3/ext4 reserved blocks

    Hello hcvv and ken_yap,

    Thanks for your explanation!
    Quote Originally Posted by ken_yap
    But of course by all means lower the reserved block percentage on seldom changing partitions.
    Lowered it on some of my data partitions.

    Thanks again!
    Where did I put my coffee cup?
    dir -R /home/* | grep "coffee cup"

  8. #8
    Join Date
    Jul 2009
    Location
    Montreal, Québec
    Posts
    833

    Default Re : Re: Re : Ext3/ext4 reserved blocks

    Hi hcvv and ken_yap,

    I also thank you for the explanations. I never thought about that. Linux is really a great system and well thought for that matter.

  9. #9
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    22,191

    Default Re: Re : Re: Re : Ext3/ext4 reserved blocks

    Quote Originally Posted by DaaX View Post
    Hi hcvv and ken_yap,

    I also thank you for the explanations. I never thought about that. Linux is really a great system and well thought for that matter.
    Let us give credit to who earns it. It is not a Linux invention. It was in Unix long before.
    Henk van Velden

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •