FreeOS.com logo

FreeOS Most Popular
* Most Read stories
* Commented Stories
* Active Categories
* Non Linux Section
* User Submitters
* Top Polls
* Top Authors
* Top Reviews
* Top Rated
* Top Search Terms

Top Articles
* Writing a Linux device driver
* The Linux filesystem explained
* Samba NT Domain Controller
* Setting up Squid as your caching HTTP/FTP proxy
* Web server tutorial - Part 1

FreeOS Highlights
* Howtos (72)
* Reviews (20)
* Opinions (18)
* Interviews (8)
* News (3)

My FreeOS

Nick:
Pass:
Register

Forgot your password?

Contact Us
Contact Us

       

Project: Linux triangle Howtos triangle

Racing to ReiserFS on Red Hat

By Mayank Sarup <Mayank@freeos.com>
Posted: ( 2001-04-16 06:49:53 EST by gatha )

A Journal Filesystem keeps track of all the transactions undertaken. And the lack of a proper journal filesystems has always been sited as one of the reasons holding back widespread adoption of Linux in the enterprise space. But this argument no longer holds true, for currently, there are four journal filesystems to choose from -- XFS, JFS, ext3 and ReiserFS. Here we shall look into ReiserFs.

Of all the journal filesystems available today, ReiserFS, is the most developed under Linux. While IBM's JFS and SGI's XFS have been around a lot longer, they are still in an prenatal stage as far as the Linux OS is concerned. Ext3 has also quite a way to go. So, for now, our choice of a journal filesystem is ReiserFS. Of course, this isn't to say that we're settling for ReiserFS for lack of a better option. ReiserFS is a good choice regardless of the number of options in the market or the quality of those options.

Why Journaling?

Journaling filesystems are sort of the elite in the business. They're what filesystems like FAT and ext2 want to grow up into. They're also essential for big enterprise server where data integrity is a priority.

The idea behind journal filesystems comes from big databases like Oracle. Database operations quite often include several related and dependent sub-operations. The failure of any one operation means that the entire operation is invalid and any changes made to the database are rolled back. Journal filesystems use a similar system.

A journal log file is maintained on the partition. Filesystem writes are first written to the log file. If a write operation is interrupted due to the machine unexpectedly going down -- power failure, crash -- then at the next boot, the journal log file is read and operations are rolled back. This process takes only a few seconds to few minutes rather than the hours that a `fsck' can possibly take, on larger servers.

A far more effective description can be seen in this LinuxGazette article.

Getting ReiserFS

Kernels 2.4.1 include the ReiserFS code. If you have kernel 2.4.1, then upgrade to kernel 2.4.3, which carries the latest ReiserFS code. Version 3.6.25 is the latest and we recommend that you start using this code as important bug fixes and updates are included in it. If you have kernel 2.4.3, then the updates are already in the kernel. We'll be using kernel 2.4.3 for this article but 2.4.2 with latest patches is equally good. Patches for the 2.2 kernels are also available but they seem to be at version 3.5.x.

Using ReiserFS

Start by patching the kernel for ReiserFS
# cd /usr/src/linux
# zcat linux-2.4.2-reiserfs-20010327.patch.gz | patch -p1

For 2.2 kernels use
# bzip2 -dc linux-2.2.18-reiserfs-3.5.32-patch.bz2 | patch -p1

Do a "make menuconfig". First thing to do is select the option "Prompt for development and/or incomplete code/drivers" under "Code maturity level options" else, ReiserFS will not be visible. Then go down to "File Systems" and compile in support for ReiserFS. If you're not interested in putting your root on ReiserFS, you can get away with compiling it in as a module. We'll be doing a root-on-reiserfs later in this article and you need to compile in support for that.

Compile the kernel and modules.

Note: If you're on Red Hat 7, first edit the Makefile and replace all instances of "gcc" with "kgcc". You will also need to install the kgcc package off your installation cdrom. This step is a must do or you will keep getting kernel panics. Gcc 2.96, which is included in Red Hat, is very buggy. All stock kernel compiles should be done using kgcc. Only Red Hat kernels will compile with gcc.

Now it's time to compile the ReiserFS utilities. The utilities are place in the directory /usr/src/linux/fs/reiserfs/utils. Do a "make" followed by a "make install" to install the programs. The utilities are not included in the 2.4 kernels and are a separate download. Get the package from this location.

Un-tar the file.
# tar zxvf reiserfsprogs-3.x.0j.tar.gz
# cd reiserfsprogs-3.x.0j
# ./configure
# make
# make install

Unfortunately, there is no "ext2toreiserfs" utility to make our lives easier. So the basic procedure for converting root (/) from ext2 to reiserfs becomes the following three-step procedure.

1. Create a new partition and format it with ReiserFS.
2. Copy data from old partition.
3. Mount new partition as root (/).

Create a new partition. ReiserFS does not require a special partition type. Use 83 (Linux).

# fdisk -l /dev/hda
/dev/hda9 2872 3126 2048256 83 Linux
/dev/hda10 3127 3381 2048256 83 Linux

Now create a ReiserFS filesystem on the new partition.

# mkreiserfs /dev/hda10

Mount the new partition

# mount -t reiserfs /dev/hda10 /mnt/hda10

Copy the data onto the new partition.

# cd /mnt/hda10
# tar cvlf - / | tar xf -

Edit fstab to point to the new root

/dev/hda10 / reiserfs defaults 1 1

Create a symlink to reiserfsck because the Red Hat boot looks for fsck.reiserfs.

# ln -s /sbin/reiserfsck /sbin/fsck.reiserfs

Get at least lilo 21.6. This was the first version to support ReiserFS. The alternative is to keep a small /boot partition that is ext2. The first option -- upgrading lilo -- is preferred. A better boot manager that we recommend for use is GRUB.

Install lilo after creating new lilo.conf entries for your new kernel and boot with it. The "root =" entry should point to the new root.

Reboot! You'll now have root on ReiserFS.

The above procedure was for putting root on ReiserFS, but it is pretty much what you will want to use when converting any of your partitions to ReiserFS. The procedure given in this article should work across distributions and partitions. But do let us know, in case you encounter any problems regarding the new kernel.

ReiserFS home
ReiserFS FAQ
LinuxGazette article on journal filesystems
XFS by SGI
IBM's JFS
Ext3 beta testing program on redhat.com

Other articles by Mayank Sarup

Current Rating: [ 7.34 / 10 ] Number of Times Rated: [ 140 ]

More Howtos
* Kernel Compilation & Avoiding ‘Unresolved Symbol’
* Configuring CVS and CVSUP on Linux
* Knoppix installation tips
* Maximum Mount
* A WebServer Guide -- Help Using Apache

Contents
Articles
  Howtos
  Interviews
  News
  Opinions
  Reviews
Comparison
Links
  Articles
  Howtos
  Interviews
  Opinions
  Reviews
  Websites
News

Linux
About Linux

Print It!
Printer Friendly Version