Mount reiserfs partitions on CentOS 4

I needed to copy some files from an old hard drive to a machine I have running CentOS 4, but the partition on the hard drive I needed to access was formatted with the reiserfs file system. The Linux kernel in CentOS 4 does not include support for reiserfs so you need to install a new kernel from the CentOS Plus repository. By doing this, the kernel is no longer the same as that provided by Red Hat’s Enterprise Linux, but you will be able to mount ReiserFS volumes.

If you try to mount a reiserfs filesystem but do not have support for reiserfs in the Linux kernel, you’ll get an error message like this:

mount: fs type reiserfs not supported by kernel

It’s possible to see what filesystems are supported by running this command:

cat /proc/filesystems

On my fairly default install CentOS 4 machine, the output of the above command was this:

nodev   sysfs
nodev   rootfs
nodev   bdev
nodev   proc
nodev   sockfs
nodev   binfmt_misc
nodev   usbfs
nodev   usbdevfs
nodev   futexfs
nodev   tmpfs
nodev   pipefs
nodev   eventpollfs
nodev   devpts
        ext2
nodev   ramfs
nodev   hugetlbfs
        iso9660
nodev   relayfs
nodev   mqueue
        ext3
nodev   rpc_pipefs
nodev   autofs
nodev   nfs
nodev   nfs4

So clearly reiserfs was not available for mounting a filesyetem. To enable it, you need to edit the /etc/yum.repos.d/CentOS-Base.repo file and then install a special CentOS Plus kernel which includes reiserfs support. Using your favourite text editor (nano in the example below), run the following command to edit the file, running it either as the root user or using sudo:

nano /etc/yum.repos.d/CentOS-Base.repo

Look for the [centosplus] section and change the enabled flag from 0 to 1 and add the includepkgs line as shown below:

[centosplus]
...
enabled=1
...
includepkgs=kernel* reiserfs-utils

Then add the following to the [base] and [updates] sections:

exclude=kernel kernel-devel kernel-smp-* kernel-hugemem* kernel-largesmp*

Now run the following command either as the root user or using sudo:

yum install reiserfs-utils kernel

This will do this:

Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Excluding Packages from CentOS-4 - Updates
Finished
Excluding Packages from CentOS-4 - Base
Finished
Reducing CentOS-4 - Contrib to included packages only
Finished
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package kernel.i686 0:2.6.9-67.0.1.EL.plus.c4 set to be installed
---> Package reiserfs-utils.i386 2:3.6.19-2.4.1 set to be updated
--> Running transaction check
 
 Dependencies Resolved
 
 =============================================================================
  Package                 Arch       Version          Repository        Size
 =============================================================================
Installing:
kernel                  i686       2.6.9-67.0.1.EL.plus.c4  centosplus         14 M
reiserfs-utils          i386       2:3.6.19-2.4.1   centosplus        434 k
 
Transaction Summary
 =============================================================================
Install      2 Package(s)
Update       0 Package(s)
Remove       0 Package(s)
Total download size: 15 M
Is this ok [y/N]:

Type in “Y” and hit enter and then this will happen:

Downloading Packages:
(1/2): reiserfs-utils-3.6 100% |=========================| 434 kB    00:04
(2/2): kernel-2.6.9-67.0. 100% |=========================|  14 MB    02:47
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: reiserfs-utils               ######################### [1/2]
   Installing: kernel                       ######################### [2/2]
 
Installed: kernel.i686 0:2.6.9-67.0.1.EL.plus.c4 reiserfs-utils.i386 2:3.6.19-2.4.1
Complete!

Once the installation has completed you need to reboot the system to load the new kernel and get access to the reiserfs partition.

After rebooting, cat /proc/filesystems will now show this:

nodev   sysfs
nodev   rootfs
nodev   bdev
nodev   proc
nodev   sockfs
nodev   binfmt_misc
nodev   usbfs
nodev   usbdevfs
nodev   futexfs
nodev   tmpfs
nodev   pipefs
nodev   eventpollfs
nodev   devpts
        ext2
nodev   ramfs
nodev   hugetlbfs
        iso9660
nodev   relayfs
nodev   mqueue
        ext3
nodev   rpc_pipefs
nodev   autofs
nodev   nfs
nodev   nfs4
        reiserfs

Note that reiserfs is now listed at the bottom, and you will be able to now successfully mount the filesystem formatted with reiserfs.