wasted disk space
Hi,
I found that of my 2GB root filesystem more than 10% is wasted because it has
been formatted by the potato installer with a 4K block size instead of 1K.
In other words if the same files are stored on a filesystem with 1K-blocks I
have other 200MB available.
This is the test I have done:
# mke2fs -i 8192 -b 1024 /dev/sdc2 `fdisk -s /dev/sdc1`
# mount /dev/sdc2 /mnt
# (cd /var/mnt/root && tar -cf -) | (cd /mnt && tar -xvf -)
# dumpe2fs /dev/sdc1 | grep size
dumpe2fs 1.18, 11-Nov-1999 for EXT2 FS 0.5b, 95/08/09
Block size: 4096
Fragment size: 4096
Inode size: 128
# dumpe2fs /dev/sdc2 | grep size
dumpe2fs 1.18, 11-Nov-1999 for EXT2 FS 0.5b, 95/08/09
Block size: 1024
Fragment size: 1024
Inode size: 128
# df /dev/sdc1
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/sdc1 2063708 1811272 147604 92% /var/mnt/root
# df /dev/sdc2
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/sdc2 2063265 1583476 374957 81% /mnt
As you can see the wasted space is 374957-147604 = 227353 = 222MB.
The difference can be easily explained if we do some calculation on the
actual size in blocks of each file:
# find . -type f -exec ls -la {} \; | ~/test.awk
SIZE 4K-SIZE 1K-SIZE DIFF FILENAME
------------------------------------------------------------------------
24536 24576 24576 0 lib/modules/2.2.17/modules.dep
13196 16384 13312 3072 lib/modules/2.2.17/block/ide-floppy.o
70060 73728 70656 3072 lib/modules/2.2.17/block/DAC960.o
27372 28672 27648 1024 lib/modules/2.2.17/block/ide-tape.o
23716 24576 24576 0 lib/modules/2.2.17/block/cpqarray.o
21696 24576 22528 2048 lib/modules/2.2.17/block/xd.o
2636 4096 3072 1024 lib/modules/2.2.17/block/linear.o
3640 4096 4096 0 lib/modules/2.2.17/block/raid0.o
10200 12288 10240 2048 lib/modules/2.2.17/block/raid1.o
19600 20480 20480 0 lib/modules/2.2.17/block/raid5.o
...
13299 16384 13312 3072 var/yp/dz-net/rpc.bynumber
28672 28672 28672 0 var/yp/dz-net/services.byname
18392 20480 18432 2048 var/yp/dz-net/netid.byname
12935 16384 13312 3072 var/yp/dz-net/protocols.bynumber
12396 16384 13312 3072 var/yp/dz-net/netgroup
12403 16384 13312 3072 var/yp/dz-net/netgroup.byhost
12403 16384 13312 3072 var/yp/dz-net/netgroup.byuser
12434 16384 13312 3072 var/yp/dz-net/networks.byaddr
12431 16384 13312 3072 var/yp/dz-net/networks.byname
12737 16384 13312 3072 var/yp/dz-net/printcap
------------------------------------------------------------------------
1538356570 1811968000 1597841408 214126592 104735 files, avg.diff 2044
As you can see the average difference is about 2K that multiplied by 104000
files gives the 200MB of wasted space. Other space is probably wasted by the
bigger indirect blocks of a 4K-blocks ext2fs.
I wonder why the root filesystem has been formatted with this inefficient
block size, given the fact that it contains a lot of small files.
In my opinion the 4K block size should be used only for large filestems or
filesystems that are used for database or ftp servers.
Any comment?
--
Massimo Dal Zotto
+----------------------------------------------------------------------+
| Massimo Dal Zotto email: dz@cs.unitn.it |
| Via Marconi, 141 phone: ++39-0461534251 |
| 38057 Pergine Valsugana (TN) www: http://www.cs.unitn.it/~dz/ |
| Italy pgp: see my www home page |
+----------------------------------------------------------------------+
Reply to: