1

While I did Ubuntu netinst, the question came into my head. The question is: is reserved 5% kind of run-time? I mean, when doing something like sudo apt install - this 5% is beign used by root at this moment? Does system use this 5% at run-time? Do I have to increase it up to 10-15% e.g.? I have 300gb hard drive. Usually I do only swap and / partitions(not using separate /home,/var or whatever).

  • What? I’m not clear on what you’re asking. Could you possibly be referring to 5% of your disk being allocated for the root partition? – Peschke Jan 8 at 23:58
  • In netinst or alternate(non graphical menu) there's a moment at partitioning: 5% reserved blocks for root. The question is is this 5% reserved blocks beign used at every day life, not at overflow, or crash cases? – D. Smirnov Jan 9 at 0:02
1

I mean, when doing something like sudo apt install - this 5% is being used by root at this moment?

Yes. No. Maybe. It doesn't quite work that way.

When you hear the term root reserve, you might think there is a specific area where only root may store files in. Like in a parking lot, you might find spots designated for people with disabilities, or spots for electric cars with charging stations next to them, or spots for parents with children. And no one else is allowed to park there.

However, the root reserve is not like that. There is no designated free space. No, it's all just the same regular free space. So where is the root reserve? It's nowhere. Nowhere specific.

Instead, anything that goes in or out has to go through the entrance/exit gate (filesystem) and is counted doing so. So the filesystem knows how many free spots there are.

And then, if you are not root and there is fewer than root reserve space left, it will simply deny you entry: sorry, not enough space left on device, please leave. (Yes I know there is still free space. But I have to keep at least X free space for root.)

Root on the other hand won't be denied entry unless there's really nothing left.

The location of the free blocks doesn't matter. It also doesn't matter who is already using which blocks. Regarding the blocks already in use, you can't say which is using the root reserve and which isn't. They all are. None of them are. Blame whoever leaves and frees up some space first.

You can delete either regular user files, or root files, to free up enough space so that regular users may be allowed to write again.

3

Reserved blocks means that some space is reserved on the disk that only superuser can use.

So, for example, if I do mke2fs -j /dev/vdb then part of the output includes..

13107 blocks (5.00%) reserved for the super user

And we can verify this

% dumpe2fs /dev/vdb | grep -i Reserved.block
dumpe2fs 1.42.9 (28-Dec-2013)
Reserved block count:     13107
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)

If we look at the disk space...

% df -k /mnt
Filesystem     1K-blocks  Used Available Use% Mounted on
/dev/vdb          999320  1320    945572   1% /mnt

Now we can change that...

% tune2fs -m 1 /dev/vdb
tune2fs 1.42.9 (28-Dec-2013)
Setting reserved blocks percentage to 1% (2621 blocks)

% dumpe2fs /dev/vdb | grep -i Reserved.block
dumpe2fs 1.42.9 (28-Dec-2013)
Reserved block count:     2621
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)

And now if we look at the free space...

% df /mnt
Filesystem     1K-blocks  Used Available Use% Mounted on
/dev/vdb          999320  1320    987516   1% /mnt

Notice the number of Available blocks has gone up.

This "spare space" is useful, especially on the disk holding logs, because it means a normal user can not fill the disk to 100%, so there's still space for the OS to keep running and logging... and hopefully the system admin will notice before that reserved space is used up!

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.