Tips on reiserfs
I decided to live dangerously last week and create a couple of reiserfs
partitions on my primary Linux server. Reiserfs is a journaling file
system that is purportedly more efficient at handling many small files
than the de facto standard ext2fs file system and just as efficient as
ext2fs in other cases.
What I like most about reiserfs is that it recovers from things such as
power failures extremely fast, since it doesn't have to perform the
lengthy consistency checks required by ext2fs. Like many other
journaling file systems (such as the one used in Windows 2000, I
believe), reiserfs won't necessarily protect your data in the event of
a power outage. But it will protect the consistency of the file system
Now put down that keyboard if you're about to send me a flame for not
using a UPS. I am using a UPS. In fact, I strongly suspect my UPS has
actually been the source of some recent power outages. My PK
Electronics Blackout Buster UPS and regulator decided to go funky on me
last week. It turned off my server twice, and I think it blew up my
Viewsonic P815 monitor with voltage spikes. I suspect the UPS because
I've had no real power outages, and I've only had problems with the
equipment plugged into the UPS. I replaced it with a UPS from Belkin,
and everything has behaved normally since.
Anyway, I reconfigured my server so that all my shared files for NFS
and Samba are now on their own reiserfs partition. I put my CommuniGate
pro mail directories on a reiserfs partition, too. My /var partition is
also a reiserfs partition, which means my Squid Web cache now operates
on reiserfs. I haven't done any benchmarks yet, but the performance of
my Web cache and proxy seems to have improved dramatically since I put
all its files on the reiserfs partition. There are supposedly Squid
cache optimizations in reiserfs, so perhaps that's why I'm seeing
noticeable results. Regardless, consider me a big fan of reiserfs so
In fact, I like it so much that I converted a few of my client
partitions to reiserfs. The only thing I haven't done yet is convert a
root partition. I tried but have failed so far. The partition that I
tried to convert is small, but it resides on a 40 GB hard drive. I
noticed afterward in the FAQ that reiserfs has problems with IDE drives
larger than 32 GB unless you apply a patch. Perhaps that is the problem
I'm experiencing. I'll work on it and get back to you.
The only other problem I've had is bizarre. I run the squidGuard
redirector along with the Squid Web cache in order to block porn sites.
(By the way, if you haven't looked at squidGuard, now is the time. It
is one delightful piece of software! See Resources for link.) Due to a
bug in one version of Squid, I needed Squid to launch the redirector by
running a script file called /usr/bin/sguard that looks something like
exec /usr/local/bin/squidGuard -c /etc/squidGuard/squidGuard.conf
Everything worked fine until I converted /usr/local into a reiserfs
partition. Then Squid stopped launching the squidGuard redirector. I
made an identical copy of /usr/local on ext2fs and tried it again. It
worked. I have no idea why I can't execute the file from /usr/local/bin
if it is a reiserfs partition.
I'd like to figure it out or get a word of advice from someone who
works on reiserfs. But my interim solution was simple. I just copied
the squidGuard program to the /usr/bin directory (which is ext2fs) and
changed the script to run it from there. That way I get to
keep /usr/local as a reiserfs partition and still avoid the problem.
Some distributions include reiserfs as a module compiled into the
kernel. In that case, you just need to make sure you have the reiserfs
utilities installed and then issue the command modprobe reiserfs to
load the module. After that, you're ready to format a partition as
reiserfs and start using it.
If you don't have reiserfs compiled into your kernel or available as a
module, fear not. It is very easy to build reiserfs support into your
kernel. Download and install the source code for the kernel of your
choice (I am using the 2.2.17 kernel).
Then download the reiserfs patch (see Resources for a link). Put the
patch in your /usr/src directory or in the directory immediately above
where you have your kernel source code.
Before you take the next step, make sure that the path to the kernel
source code is /usr/src/linux. If it isn't, then rename the kernel
source code directory or create a symbolic link to provide that path.
For example, the default Debian source code directory might be kernel-
source-2.2.17. In that case, you want to create a symbolic link such as
cd /usr/src; ln -s kernel-source-2.2.17 linux.
Now apply the patch. Change to the /usr/src directory and use the
command zcat linux-2.2.17-reiserfs-3.5.27-patch.gz | patch -p0 to apply
the patch. If you hastily decompressed the file, then run the command
patch -p0linux-2.2.17-reiserfs-3.5.27-patch instead.
Now you need to configure your kernel. There are several ways to do
that, but I prefer to change to the /usr/src/linux directory and run
make menuconfig for that step. You'll need ncurses development
libraries installed for that to work. If you're a hard core Linux user
or want to become one, just run make config instead. You can also run
make xconfig if you prefer a graphical configuration tool.
You should notice a reiserfs option in the configuration process under
the topic file systems now. Select it. I have reiserfs configured as a
loadable module, since that makes it easier to fix any potential
reiserfs problems in the future without having to recompile the whole
kernel. There is another option to enable reiserfs internal checks.
That option is really for debugging purposes, so I strongly recommend
that you do not use it, since it will slow reiserfs' performance.
If this is your first attempt at creating a custom kernel, you'll need
to step through all the options and make sure your kernel supports
everything you need for your system. It is way beyond the scope of this
column to walk you through that process. I recommend reading the README
file in the /usr/src/linux directory for instructions on how to
configure and install your new kernel.
Finally, you'll need to compile the reiserfs utilities and install
them. It is a very simple process. Just change to
the /usr/src/linux/fs/reiserfs/utils directory and run make dep; make;
Now create a partition that you want to format as reiserfs. Mark the
partition as a Linux filesystem, the same way you would if you were
about to create a standard ext2 filesystem. Assuming your new partition
is /dev/hdb3, you would then run mkreiserfs /dev/hdb3 to format the
partition. That process will overwrite any data you may have on that
partition, so be sure you know what you're doing. Now mount the
partition and get to work!