Lampros - Weird Bricks

Installing JFS and mkfs.jfs on CentOS 7

20 October, 2017 | CentOS

JFS is a journaling file system originally developed by IBM. It's considered to be mature and stable but it's not commonly found on Linux servers. I was curious to see what it would take to install it and later benchmark it. I'll cover the installation here and will do a benchmark comparison on a later post. 

I did find a kernel module here but unfortunately I run into trouble installing it. I'll describe how I got it to work.

1. Install the ELRepo:

yum -y install

2. Install the kernel module 'kmod-jfs':

yum --enablerepo=elrepo* install kmod-jfs -y

3. So far, so good - let's try to load the module:

modprobe jfs
modprobe: FATAL: Module jfs not found.

4. That's strange. Let's see if we can find the module. First, let's install the `yum-utils` package so that we can get the `repoquery` command and see what the package installed:

yum -y install yum-utils

5. Now let's see the package contents using `repoquery -l kmod-jfs`:

repoquery -l kmod-jfs

6. As you can see it should have installed the `/lib/modules/3.10.0-514.el7.x86_64/extra/jfs/jfs.ko` file. Let's confirm:

file /lib/modules/3.10.0-514.el7.x86_64/extra/jfs/jfs.ko
/lib/modules/3.10.0-514.el7.x86_64/extra/jfs/jfs.ko: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), BuildID[sha1]=7d6bcbb3b4d868f77f308ee2d41230fefecfbfcc, not stripped

And there it is.

7. Let's get some more information about this module using the `modinfo` command:

modinfo /lib/modules/3.10.0-514.el7.x86_64/extra/jfs/jfs.ko
filename: /lib/modules/3.10.0-514.el7.x86_64/extra/jfs/jfs.ko
alias: fs-jfs
license: GPL
author: Steve Best/Dave Kleikamp/Barry Arndt, IBM
description: The Journaled Filesystem (JFS)
rhelversion: 7.3
srcversion: A8C71449C466986CE8F94DD
vermagic: 3.10.0-514.el7.x86_64 SMP mod_unload modversions
signer: The ELRepo Project ( Secure Boot Key
sig_key: F3:65:AD:34:81:A7:B2:0E:34:27:B6:1B:2A:26:63:5B:83:FE:42:7B
sig_hashalgo: sha256
parm: nTxBlock:Number of transaction blocks (max:65536) (int)
parm: nTxLock:Number of transaction locks (max:65536) (int)
parm: commit_threads:Number of commit threads (int)

The vermagic seems to point to a different kernel version than ours: 3.10.0-514.el7.x86_64 SMP

Here's our kernel version:

uname -r

8. Looks like the correct kernel version happens to be installed but not enabled:

rpm -qa | grep -i kernel

9. Follow my instructions here to install the right tools to switch the kernel - I'll go through the steps real fast:

yum -y install grub2-tools grub2-tools-minimal
echo "GRUB_DISABLE_SUBMENU=y" >> /etc/default/grub
grub2-mkconfig -o /boot/grub/grub.cfg

Check the installed kernels:

awk -F\' '$1=="menuentry " {print i++ " : " $2}' /boot/grub/grub.cfg 
0 : CentOS Linux (3.10.0-514.16.1.el7.x86_64) 7 (Core)
1 : CentOS Linux (3.10.0-514.16.1.el7.x86_64) 7 (Core) (recovery mode)
2 : CentOS Linux (3.10.0-327.22.2.el7.x86_64) 7 (Core)
3 : CentOS Linux (3.10.0-327.22.2.el7.x86_64) 7 (Core) (recovery mode)
4 : CentOS Linux (0-rescue-ed21cfeae62c9d8b440cbc3f8e696dce) 7 (Core)
5 : CentOS Linux (0-rescue-ed21cfeae62c9d8b440cbc3f8e696dce) 7 (Core) (recovery mode)

We set the kernel to `0`:

grub2-set-default 0

and reboot: `reboot`

10. SSH back in and check your kernel version:

uname -r

11. Cool, now try the `modprobe` command again:

modprobe jfs

No output - let's check what `lsmod` has to say:

lsmod | grep -i jfs
jfs 180330 0

And it's good to go!

Installing the JFS tools:

1. Install some dependencies to compile the jfs tools:

yum -y install gcc e2fsprogs-devel libuuid-devel

2. Get the jfs tools - this will give us mkfs.jfs:

cd /tmp
tar -xzf jfsutils-1.1.15.tar.gz
cd jfsutils-1.1.15

3. Fix a bug by editing the file ./fscklog/extract.c - then find the line:

You can fix this by running:

sed -i -e '/#include <unistd.h>/a#include <sys/types.h>' ./fscklog/extract.c

Or if you would like the details:

#include <unistd.h>

then after that line, add this one:

#include <sys/types.h>

otherwise you might get this error:

extract.c: In function ‘readwrite_device’:
extract.c:601:8: warning: implicit declaration of function ‘ujfs_rw_diskblocks’ [-Wimplicit-function-declaration]
ujfs_rw_diskblocks(Dev_IOPort, dev_offset,
extract.c: In function ‘validate_super’:
extract.c:743:3: warning: implicit declaration of function ‘ujfs_get_dev_size’ [-Wimplicit-function-declaration]
ujfs_get_dev_size(Dev_IOPort, &bytes_on_device);
make[2]: *** [extract.o] Error 1
make[2]: Leaving directory `/tmp/jfsutils-1.1.15/fscklog'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/jfsutils-1.1.15'
make: *** [all] Error 2

4. Compile, make and install the jfs tools:

make -j`nproc`
make install

5. Nice - and now we have a mkfs.jfs:

which mkfs.jfs

6. Format your disk:

mkfs.jfs /dev/sda1 
mkfs.jfs version 1.1.15, 04-Mar-2011
Warning! All data on device /dev/sda1 will be lost!
Continue? (Y/N) y
Format completed successfully.
732419383 kilobytes total disk space.

7. And mount it:

mkdir /mnt/jfs
mount /dev/sda1 /mnt/jfs

8. Check the output of df -hT /mnt/jfs/ :

df -hT /mnt/jfs/
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda1 jfs 3.0T 376M 3.0T 1% /mnt/jfs