Space "consumed" by ReiserFS: is ext3 better for small partitions?
After using ext3 quite happily on my Slackware 10.0 system, I decided to repartition, upgrade to 10.2, and give reiserfs a try.
I decided I wanted a small (about 70MB) /var partition. After the whole installation was over, I ran
$ df- h
to see how well i'd guessed my partition sizes. Surprisingly, my /var partition apparently contained about 55MB and hence was already 75% full! Strangely,
$ du -hs
only reported about 20MB used space, and I couldn't figure out where the &*"%^£ the remaining space was going.
I began to experiment: I tar'ed up /var, reformatted the partition to ext3, and un-tarr'ed the contents back.
df now reported the 20-something MB of used space i expected. I then switched back to reiserfs and un-tarr'ed again. Now, as before, df reported 50-something MB used.
After some experiments, my discovery is this: On a completely empty partition, Reiserfs usually has an overhead of about 33MB when using the default block size of 4096. You can see this in the output of mkreiserfs:
Count of blocks on the device: 19520
Number of blocks consumed by mkreiserfs formatting process: 8212
(8212*4092 = about 33MB, which is 42% usage of my partition before even adding any files!)
After some more research I noticed that mkreiserfs always seems to "consume" the same number of blocks when formatting regardless of the size of the partition (about 8000-10,000 blocks). So I did:
$ mkreiserfs --block-size 1024 /dev/hda5
which sure enough gave:
Count of blocks on the device: 78080
Number of blocks consumed by mkreiserfs formatting process: 8202
i.e. a more reasonable 8MB overhead, but still 10% of my 80MB partition. Consider that EXT3's overhead on the same partition with a 1024 block size is 4MB. Does my experience suggest that ext3 is a better choice on small partitions?
In the end I decided to use reiserfs with the block size set to the minimum of 512. Although this gives a very small space overhead, from what i've gathered using small block sizes degrades speed. Any opinions?
For interest: on a nearly 1GB partition, reiserfs has about the same 33MB space overhead mentioned above, while ext3 only uses around 17MB. However, I'm guessing that adding a lot of small files to the two empty filesystems would see reiserfs quickly start using less space overall than ext3? I've spent too much time on this to test it right now :-P