For most of Linux’s history, the extended2 (ext2) filesystem has been the standard, although the Linux kernel can be configured to read/write many other types of filesystems. Recently, work has been done on some new filesystem types in an attempt to improve on the performance of ext2. Ext3 and ReiserFS are two of these projects. […]
For most of Linux’s history, the extended2 (ext2) filesystem has been the standard, although the Linux kernel can be configured to read/write many other types of filesystems. Recently, work has been done on some new filesystem types in an attempt to improve on the performance of ext2. Ext3 and ReiserFS are two of these projects. Ext3 adds journaling to ext2, whereas ReiserFS is a whole new filesystem, with journaling. This article will focus on the strengths and weaknesses of ReiserFS, as well as how to go about setting it up, should you decide to give it a try.
Journaling |
If you’re not familiar with database systems, journaling means that each transaction is written to a journal, or log. It is then possible to replay this journal in the event of a catastrophe and recover the lost transactions. Periodically, the journal is flushed, after it is certain the transactions have taken place. In addition, for performance reasons, the author of ReiserFS has chosen to store both the file names and the files in a database, rather than just the file names and locations. This arrangement allows better storage of small files. Rather than allocating a whole block for a file that is smaller than the block size, small files are combined for optimal usage of disk space. |
ReiserFS has a number of strengths:
Of course, it also has its weaknesses:
When you use ReiserFS, you’ll need to take a number of precautions:
#define REISERFS_READ_LOCK
in linux/include/linux/reiserfs_fs.h.
Several utilities are included with ReiserFS kernel patches:
I am currently running ReiserFS on /home and /usr on a SuSE7.0 Linux install, leaving the / partition as ext2. SuSE 7.0 comes with ReiserFS as an install option, if you pick the expert install. For testing purposes, I created equivalent partitions /usr2, and /home2 using ext2. The following is the output from mount:
larry:~ # mount /dev/hda2 on / type ext2 (rw) proc on /proc type proc (rw) /dev/hda1 on /boot type ext2 (rw) /dev/hda5 on /usr type reiserfs (rw) /dev/hda7 on /home type reiserfs (rw) |
To use ReiserFS, you have to patch the kernel source before you can include it in your options. You can download appropriate kernel patches from ftp://ftp.lugoj.org/pub/reiserfs/devlinux.com/pub/namesys/. There are patches for kernel versions 2.2.14 through 2.2.17, the 2.3 series, and the new 2.4.0 kernel.
To apply the kernel patches, do the following:
cd /usr/src zcat linux-2.2.16-reiserfs-3.5.24-patch.gz | patch -p0 |
(I was patching a 2.2.16 kernelyours may vary.)
When configuring the kernel, answer “y” or “m” (module) to the ReiserFS support question. Then compile and install the kernel image and modules as usual. ReiserFS utilities are located in the patched kernel source tree in linux/fs/reiserfs/utils. They are built and installed in the usual manner:
cd /usr/src/linux/fs/reiserfs/utils make make install |
Boot with your newly built kernel, run mkreiserfs on a spare partition, and mount it. If you want to replace an existing ext2 partition with the new one, it would be wise to boot into single-user mode; then you can either copy the files from the existing partition to the new one or restore to the new partition from backup media. To copy, I generally use the following:
mount /dev/hdx /mnt/temp (new reiserfs) cd /home (old ext2 fs) tar -cf - . | (cd /mnt/temp;tar -xf -) |
These commands will copy everything from the existing partition to the new one. You can then umount both partitions, edit /etc/fstab appropriately, and remount your new /home. Here is a sample /etc/fstab entry for a Reiserfs partition:
/dev/hda7 /home reiserfs defaults 1 2 |
ReiserFS has a few mount/re-mount options:
mount -o remount,resize=<new blockcount> <reiserfs mount point> |
Of course, you need additional free space on the drive or you may end up consuming an adjacent partition.
Bonnie++ is a program to test hard drives and file systems for performance. As the man pages for the program mention, there are many different types of filesystem operations. Bonnie++ tests some of them and for each test gives a result of the amount of work done per second and the percentage of CPU time this took. For performance results, higher numbers are better; for CPU usage, lower numbers are better. Bonnie++ can be downloaded from http://www.coker.com.au/bonnie++/.
Here are the results of the test on my machine. I was the only user on the system. X was only running in login mode, and the normal system daemons were running. Here are the hardware specs:
I ran Bonnie++ with the defaults, reading and writing first from a 200 MB file, and then creating/reading/deleting from 30 files:
/home/stew (ReiserFS): Version 1.00d ------Sequential Output------ --Sequential Input- --Random- -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks-- Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP larry 200M 1305 95 4431 78 2231 70 1342 95 4560 84 13.6 1 ------Sequential Create------ --------Random Create-------- -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete-- files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP 30 1476 98 10719 99 2265 100 1497 99 10617 99 2079 99 /home2/stew (ext2): Version 1.00d ------Sequential Output------ --Sequential Input- --Random- -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks-- Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP larry 200M 1365 94 5000 80 2296 75 1351 94 4561 82 13.9 1 ------Sequential Create------ --------Random Create-------- -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete-- files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP 30 71 99 246 99 1460 98 72 99 272 100 181 70 |
In the case of the single 200 MB file, ReiserFS and ext2 were pretty similar. But for the small file manipulations, ReiserFS was much faster. Also note the difference between random and sequential deletes in ext2.
I also killed the power on the system a number of times without shutting down properly, and the ReiserFS partitions were checked and back online in less than a second when the system came back up. On the other hand, the ext2 partitions took 20 to 40 seconds to run e2fsck.
The following statements were listed as testimonials on the ReiserFS Web pages. SourceForge is a developer resource that sponsors open source projects; the site is run by VALinux. Mozilla is the open source spin-off from the commercial Netscape browser:
CrossLinks |
|
I hope this overview gives you some insight as to the pros and cons of using ReiserFS. My experience so far has been good, and I may adopt it the next time I upgrade my server. In the meantime, I’ll continue running it on this test system, and perhaps load up a database and give it a bit more of a workout. //
Stew Benedict is a systems administrator for an automotive manufacturer in Cleveland, Ohio. He also is a freelance consultant, and runs AYS Enterprises, which specializes in printed circuit design, Microsoft Access solutions for the Windows platforms, and utilizing Linux as a low-cost alternative to commercial operating systems and software. He has been using and promoting Linux since about 1994. When not basking in the glow of a CRT, Stew enjoys time with his wife, daughter, and two dogs at his future (not too much longer!) retirement home overlooking Norris Lake in the foothills of the Smoky Mountains in Tennessee.
Enterprise Networking Planet aims to educate and assist IT administrators in building strong network infrastructures for their enterprise companies. Enterprise Networking Planet contributors write about relevant and useful topics on the cutting edge of enterprise networking based on years of personal experience in the field.
Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved
Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.