Mailinglist Archive: opensuse (1695 mails)

< Previous Next >
Re: [opensuse] Percentage of blocks reserved for root on ext3 formatted partitions
  • From: David Haller <opensuse@xxxxxxxxxx>
  • Date: Wed, 24 Sep 2008 05:03:12 +0200
  • Message-id: <20080924030312.GA13859@xxxxxxxxxxxxxxxxxx>
Hello,

On Sun, 21 Sep 2008, Bob Williams wrote:
[..]
That's very interesting. On a 750GB disc, the amount allocated to root is
therefore 37.5GB, which seems a mighty big log file. Or does it function as a
kind of local swapfile if the disc gets too full? Similar to Windows
defragmenter needing 15% freespace.

No, it's functions only as "reserved", for when the disk is (almost)
full and some space for logging is required or root needs some space
left to clean up.

Do you think 1% (equivalent to 7.5GB in my example above) would be
sufficient?

Yes. More than sufficient. 0.1% would feel about right, unless it's
just a data-dump seeing no "live action". With "data-dump" defined as
a filesystem, to or from which files are moved/copied occasionally and
otherwise "rest" unchanged on that filesystem. I.e. no log-files, no
textfiles being edited etc., no stuff being generated by some program.

I'm talking about an external SATA drive that's used for backups and archives.

In that case, I'd simply use '0%' as that seems to qualify as a
"data-dump". If the disk is full, it's full, and the backup
fails. And backups run usually as root anyway.

The 5% default is from times when drives and partitions were much
smaller than today. I dare say 1 GB of reserved space is the upper
limit of usefulness in most cases.

On smallish partitions (<20 GB), used as /, /var or /home etc., I use
the default 5%, on largish partitions less (e.g. 2%), depending on
use. On mere "data-dumps" like your external drive '0%' is reasonable.

If you store only few large files on a FS, creating the FS with fewer
inodes could also be considered (e.g. '-T largefile', see 'man mke2fs'
for details. Ext2 can be considered, but what's the e.g. 130 MB of the
journal vs. fsck-time after a crash? Especially when, as in my uses,
filesizes are mostly 300 MB and above anyway. If all else fails, you
can convert ext3 back to ext2 (tune2fs -O ^has_journal) as long as you
haven't used other ext3 specific features.

BTW, at least 'tune2fs -m' understands decimals, so you can use e.g.

tune2fs -m 0.1 /dev/...

This little "one-liner"[1] might help, it assumes all partitions
are ext2/3:

====
#!/bin/bash
for d in $(awk '/dev\/([hs]d|root)/ { print $1; }' /proc/mounts); do
tune2fs -l "$d" | awk -vd="$d" -F':' '
BEGIN { G=1024^3; }
/Block size/ { S=$2; }
/Reserved block count/ { r = $2; }
/Block count/ { b = $2; }
END {
printf "%s\t % 4.1f GB of % 6.1f GB = %.0f%%\n",
d, r*S/G, b*S/G, r*100/b;
}';
done
====

It prints the device, the size of reserved space, the size of the
partition and the corresponding percentage of reserved space.

HTH & HAND,
-dnh

[1] developed as such, changed here for readability

--
So Linus, what are we doing tonight?
The same thing we do every night Tux. Try to take over the world!
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >