RedHat's enterprise operating system doesn't provide support for XFS out of the box, due to support limitations. XFS is a mature and stable file system however, and has benefits in a number of areas, including file streaming, snapshotting, growing, and online defragmentation. In this brief article, I'll walk you through the process of adding XFS support to your RHEL5 (or CentOS) boxes.
XFS comes in two parts: userland tools (xfsprogs) for creating/checking/etc XFS partitions and xfs-kmod, the kernel module required to support XFS.
The first part is easy: get the RPM from RPM pbone for AMD64 and i386. If you can't reach these, just go to RPM pbone.net and search for xfsprogs.
The xfsprogs package should not have any requirements, so simply install it with
rpm -i xfsprogs-2.9.4-4.el5.i386.rpm
Now comes the slightly more difficult part: including XFS support in your kernel. You'll need several packages before you can add XFS support. We'll be building this ourselves, so we'll certainly need gcc and kernel-sources, then we'll need some rpm tools to build and install the xfs-kmod ourselves.
But before you begin, you may wish to take this time to update your kernel to the latest revision. You might also want to reboot after you do that to avoid confusing any scripts that might use 'uname -r'.
Alright, let's get the dependencies out of the way:
yum install gcc kernel-devel rpm-build
Say yes to install all these packages and their dependencies. You'll need gcc to compile the XFS module source code, kernel-devel to supply your kernel's source code, and rpm-build to create the xfs-kmod rpm we're going to install.
With our tools installed, we need to build the module. I stumbled upon this mailing list thread at SGI's website which has a link to this site provided by Eric Sandeen. (Thanks Eric!)
The website gives the directions we'll be using to build the kernel module:
XFS for RHEL5To rebuild, install matching kernel and kernel-devel packages, and do something like this:
rpmbuild --rebuild --define 'kvariants ""' xfs-kmod-0.4-2.2.6.18_8.el5.src.rpm
(Note, this will rebuild against any RHEL5 kernel, not just 2.6.18-8.el5)
where kvariants may also include things like "xen" for different kernel flavors.
If you need to build for a kernel other than the version currently running, also add: --define 'kversion (whatever)' to the commandline
It's completely untested. It builds. Let me know how it goes. :)
You'll need xfs userspace too of course; for now check FC5 or FC6 for that.
-Eric
Awesome! This will let us build the kernel module for whatever kernel we want, provided we have the proper kernel-devel package installed. Download the xfs-kmod file onto your machine (I used xfs-kmod-0.5-2.2.6.18_88.el5.testing.src.rpm). Now build the kernel module:
# rpmbuild --rebuild --define 'kvariants ""' xfs-kmod-0.5-2.2.6.18_88.el5.testing.src.rpm
If rpmbuild finishes successfully, you should see a line like
Wrote: /usr/src/redhat/RPMS/x86_64/kmod-xfs-0.5-2.2.6.18_92.1.1.el5.testing.x86_64.rpm
and sure enough:
Having built our xfs-kmod package for RHEL5, we'll install the package, load the module, and (if you have a partition available) we'll test out mkfs.xfs on it.
Excellent, the module has loaded! You can now use mkfs.xfs to create a XFS partition on your machine. No additional work is required for your system to support xfs; /etc/fstab, mount, and the kernel will load the module as needed and can automatically detect when a XFS partition is being mounted.
Post new comment