Enabling ReiserFS, XFS, JFS on RedHat Enterprise Linux

Posted by: admin  :  Category: RHEL

Despite the Linux kernel having support for so many file systems, not all of them are enabled in RedHat Enterprise Linux by default. This might be well as some of them might not yet classify as “enterprise grade” in the eyes of RedHat, who knows… Luckily, support for missing file systems such as ReiserFS, XFS and JFS can be added easily as outlined below.


For this howto I assume you are running the stock RedHat kernel.

Get an RPM repository

First of all, you need access to an RPM repository. Usually this is your setup cd-rom or a network-accessible (FTP, HTTP or even NFS) directory. I assume you have this setup already, so let’s proceed to the next step.

Install requireds packages

You’ll need the toolchain, rpm-build, the glibc and kernel headers as well as the kernel source RPM from redhat. Issue this to see what kernel header version is required for you:

# uname -a
Linux localhost 2.6.18-53.el5 #1 SMP Wed Oct 10 16:34:19 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux

Install them as required using yum:

#yum install rpm-build.x86_64 ncurses-devel.x86_64 gcc.x86_64 redhat-rpm-config unifdef
[ ... output omitted ... ]
=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 gcc                     x86_64     4.1.2-14.el5     base              5.3 M
 ncurses-devel           x86_64     5.5-24.20060715  base              1.7 M
 redhat-rpm-config       noarch     8.0.45-22.el5    base               53 k
 unifdef                 x86_64     1.171-5.fc6      base               15 k
Installing for dependencies:
 cpp                     x86_64     4.1.2-14.el5     base              2.9 M
 glibc-devel             x86_64     2.5-18           base              2.4 M
 glibc-headers           x86_64     2.5-18           base              598 k
 kernel-headers          x86_64     2.6.18-53.el5    base              814 k
 libgomp                 x86_64     4.1.2-14.el5     base               77 k

Transaction Summary
=============================================================================
Install      9 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 14 M
Is this ok [y/N]:

This will install everything you need to get going in the first place. Now go and get the kernel source RPM, which you’ll find at the RedHat FTP Site. Save it to a temporary directory and install it accordingly:

# mkdir /usr/src/sources && cd /usr/src/sources
# wget ftp://ftp.redhat.com/pub/redhat/linux/enterprise/5Server/en/os/SRPMS/kernel-2.6.18-53.1.6.el5.src.rpm
# rpm -ivh kernel-2.6.18-53.1.6.el5.src.rpm

This will throw some messages at you about a user/group named “brewbuilder” not being there. That means no harm, however you may prefer to create it first. Now everything needed should exist inside your /usr/src/redhat directory. Then run rpmbuild from the redhat tree.

# cd /usr/src/redhat
# rpmbuild -bp SPECS/kernel-2.6.spec
[ ... output omitted ... ]

Enable the file systems

Now you need to initialize the kernel build environment like this from the kernel source tree. You will also need to copy the original kernel config from your current RedHat kernel.

# cd /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.x86_64
# cp /boot/config-`uname -r` .config
# make menuconfig

From “menuconfig” navigate to “File systems”, where you enable the missing modules. In my case I select “Reiserfs support”, “JFS” and “XFS” to be included as module (“M” marking). This is especially required if you just want to build the module and copy it over to your locally installed kernel modules directory. I’d recommend to create an RPM for proper upgrade management anyway, however in this case it actually doesn’t matter (except in terms of overhead and performance of course) it you’re using a module or compile it into the kernel. Afterwards I exit from “menuconfig”, not without saving the changes of course.

Compiling and installing the modules the lazy way

Now this is what I call the lazy way… For easy upgrades and package management, I’d strongly recommend you create a fullblown RPM (see next section). However, if you just want to get going, you can compile the modules manually like this:

# cd /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.x86_64
# mkdir .tmp_versions
# make fs/xfs/xfs.ko
# make fs/jfs/jfs.ko
# make fs/reiserfs/reiserfs.ko

Then add the modules made to your current module directory like this:

# mkdir /lib/modules/`uname -r`/kernel/fs/reiserfs
# mkdir /lib/modules/`uname -r`/kernel/fs/xfs
# mkdir /lib/modules/`uname -r`/kernel/fs/jfs
# cp ./fs/reiserfs/reiserfs.ko /lib/modules/`uname -r`/kernel/fs/reiserfs
# cp ./fs/xfs/xfs.ko /lib/modules/`uname -r`/kernel/fs/xfs
# cp ./fs/jfs/jfs.ko /lib/modules/`uname -r`/kernel/fs/jfs
# depmod -a

This will leave you with modules suiting your kernel. However, whenever you’re upgrading the kernel package, they may get overwritten, so it’s best to create a kernel rpm and install it as a regurlar package.

Building a full-featured RPM

Before you create your RPM package, it’s recommended you edit the Makefile and replace the EXTRAVERSION header by something meaningful which makes the difference clear.

# cd /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.x86_64
# vi Makefile

In this case, I’ve set EXTRAVERSION = -jfsxfsreiserfs_2.6.18_53_1.6. Then simply run this command to create the RPM package:

# cd /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.x86_64
# make rpm

Like this you’ll end up with both a new RPM package and a source RPM inside your /usr/src/redhat/RPMS and /usr/src/redhat/SRPMS directories, which can then be installed via rpm or, if integrated with a local yum repository, from yum itself.

Getting the tools

Of course, the modules themselves serve no practical purpose if you lack the userspace tools to create and maintain the file systems. Get them accordingly from ftp://oss.sgi.com/projects/xfs/ (XFS), http://jfs.sourceforge.net/ (JFS) and http://chichkin_i.zelnet.ru/namesys/ (ReiserFS). Again, it’s recommended to create an RPM from the sources, but this is beyond the scope of this article.

17 Responses to “Enabling ReiserFS, XFS, JFS on RedHat Enterprise Linux”

  1. Vemu Ramesh Says:

    Hi
    As per this document i have recompile kernel with xfs,jfs and reiserfs. But this document is uncompleted.

    any how thanks

  2. Gianpaolo Del Matto Says:

    Hello Vemu Ramesh

    What’s missing there?
    I’ll be happy to complete anything that
    might be missing in the article.

    Greetings,

    Gianpaolo

  3. Chris V Says:

    Hi Gianpolo,

    Thanks for the great article. It was just what the doctor ordered for me to add jfs to my RHEL5 kernel. My only comment is that after I installed the custom kernel rpm, I had to run `mkinitrd /boot/initrd-[my custom kernel version].img [my custom kernel version]` and then create the grub.conf entry for booting the new kernel, e.g.:

    title Red Hat Enterprise Linux Server (2.6.18-53.1.19-jfs.el5)
    root (hd0,2)
    kernel /vmlinuz-2.6.18-53.1.19-jfs.el5 ro \ root=/dev/VolGroup_ID_30796/LogVol1 rhgb quiet
    initrd /initrd-2.6.18-53.1.19-jfs.el5.img

    and decide what order I wanted it in the grub.conf listing (or modify the default= parameter).

    The custom-kernel install didn’t do these parts for me, as a RHEL kernel install normally does.

    Thanks again,
    Chris

  4. Luca Says:

    After kernel install from rpm mkinitrd should be used to generate the initrd image for the new kernel, booting will likely fail otherwise:

    # mkinitrd /boot/initrd-.img

    also grubby fails to update grub’s menu.lst in my case, so i needed to add an entry to boot the new kernel by hand.

    ciao

    Luca

  5. Kolesar Says:

    Hi,

    I get error on make:

    [root@testni 2.6.18-8.el5-i686]# make ./fs/reiserfs/reiserfs.ko
    CHK include/linux/version.h
    CHK include/linux/utsrelease.h
    make[1]: *** No rule to make target `fs/reiserfs/bitmap.o’, needed by `fs/reiserfs/reiserfs.o’. Stop.
    make: *** [fs/reiserfs/reiserfs.ko] Error 2

    Please help.

    With regards.
    Kolesar

  6. Luis Perez Says:

    Can you please provide pointers as to where I can find info to create RPM’s for the reiserfs utilities?

  7. Bonzo Says:

    I just needed a quick fix for temporary access to a reiserfs disk. This did the trick. Thanks for taking the time to share this.

  8. animeboy Says:

    If you just need kernel modules for a non boot drive, the following will work too, and doesn’t require you to replace your existing kernel (You don’t even need to reboot)

    Works for JFS too, just replace XFS with JFS (Or copy the lines)

    # uname –r
    NOTATE THE NUMBERS ( ie 2.6.X.X) Change X.X to whatever your kernel version is
    # mkdir /usr/src/sources # cd /usr/src/sources
    GET THE SRC RPM FROM ftp://ftp.redhat.com/pub/redhat/linux/enterprise/VERSION DIRECTORY]/en/os/SRPMS/kernel-2.6.X.X-EL.src.rpm
    # rpm -ivh kernel-2.6.X.X-EL.src.rpm
    # cd /usr/src/redhat
    # rpmbuild -bp SPECS/kernel-2.6.spec # cp -r /usr/src/redhat/BUILD/kernel-2.6.9/linux-2.6.9/fs/xfs/. /lib/modules/$(uname -r)/build/fs/xfs/
    # cd /lib/modules/$(uname -r)/build
    # make menuconfig
    ADD XFS SUPPORT
    # cd /lib/modules/$(uname -r)/build
    # make SUBDIRS=fs/xfs/ modules
    # cd /lib/modules/$(uname -r)
    # mkdir kernel/fs/xfs
    # cp build/fs/xfs/xfs.ko kernel/fs/xfs/
    # chmod 744 kernel/fs/xs/xfs.ko
    # depmod
    # modprobe xfs

  9. ScientificLinux user Says:

    Just to say, months after the original article, that some more recent clone distros now have XFS support (but not the others) built in: see https://www.scientificlinux.org/distributions/5x/rnotes/SL.releasenote.5.2.i386

  10. Drunk Genius Says:

    AWESOME article. This saved me trying to get xfs working on an EC2 AMI from Oracle that, for some reason, was lacking it. Perfect instructions.

  11. John-Isaac Says:

    GREAT GUIDE! Saved my rear. Was so helpful, I wrote up a quick post about my experiences.

    http://www.john-isaac.com/2009/01/xfs-support-for-rhel5/

    Thanks man!

    jC

  12. Prentice Says:

    You also need to install this rpm (and it’s dependencies) to create the /usr/src/redhat directory hierarchy and install the tools you need to build the RPMs (including rpmbuild itself):

    rpm-build

  13. Costyn Says:

    Thank you so much!!! This howto was a lifesaver.

  14. vlad Says:

    After
    # make menuconfig
    type:
    # make

  15. JFS and RHEL5 | [ themattreid ] Says:

    [...] Quick one here; If you’re thinking to yourself “why can’t I make the MySQL data partition JFS on my RHEL5 server…” here’s a good how to: http://phaq.phunsites.net/2008/02/04/enabling-reiserfs-xfs-jfs-on-redhat-enterprise-linux/ [...]

  16. Habutre Says:

    In my case I just install two packages

    yum install kmod-reiserfs reiserfs-utils

    And I be able to read and mount reiserfs

  17. kmod-xfs quetion Says:

    [...] copy them. Important information about kernel headers and rpm-build and etc. are one this page. http://phaq.phunsites.net/2008/02/04…erprise-linux/ Kernel modules for XFS filesystem: Just click on the link under "Packages" [...]

Leave a Reply