IBM's Journaled Filesystem
In December 1999, three potential journaling filesystems were begun or were in the process of being developed or ported to Linux. Ext2 was adding journaling to its filesystem under the name of ext3. SGI began to port their XFS filesystem from IRIX. The third filesystem was being developed by Hans Reiser and came to be called ReiserFS. But none of these filesystems were fully functional on Linux in 1999. IBM believed that JFS was a strong technology and could add value to the Linux operating system.
Contacts were made with the top Linux filesystem developers and the possibility of adding yet another journaling filesystem was explored. One of the basic underlying philosophies of Linux is that choice is good, so the idea of another journaling filesystem was accepted.
IBM started moving JFS to Linux in December 1999, and by February 2000, they had released the first source code. This initial release contained the reference source code, the mount/unmount function and support for the ls command on a JFS partition.
JFS has been incorporated into the 2.5.6 Linux kernel and also is included in Alan Cox's 2.4.X-ac kernels, beginning with the February 2002 release of 2.4.18-pre9-ac4. Alan's patches for the 2.4.x series are available from kernel.org. You also can download a 2.4 kernel source tree and add the JFS patches to this tree. JFS comes as a patch for several of the 2.4.x kernels, so get the latest kernel from kernel.org.
At the time of this writing, the latest kernel is 2.4.18 and the latest release of JFS is 1.0.20. We use them in the following section. The JFS patch is available from the JFS web site. You also need both the utilities (jfsutils-1.0.20.tar.gz) and the filesystem (jfs-2.4.18-patch and jfs-2.4-1.0.20.tar.gz) patches. Several Linux distributions are already shipping JFS: Turbolinux, Mandrake, SuSE, Red Hat and Slackware all ship JFS in their latest releases.
If you use any of the previously named distributions, you do not need to patch the kernel for the JFS code. You need only to compile the kernel to support JFS (either as built-in or as a module).
First, download the standard Linux kernel. If you have a /usr/src/linux directory, move it, so it won't replaced by the linux-2.4.18 source tree. After you download the kernel, named linux-2.4.18.tar.gz, save it under /usr/src and untar it. This operation will create a new /usr/src/linux directory.
The next step is to get the JFS utilities and the appropriate patch for kernel 2.4.18. Create a directory for JFS source, /usr/src/jfs1020, and download to that directory the JFS kernel patch, the jfs-2.4-18-patch and the JFS patches, jfs-2.4-1.0.20.tar.gz. At this point, you have all the files needed to patch the kernel.
Next, change to the directory of the kernel 2.4.18 source tree to apply the JFS kernel patch:
% cd /usr/src/linux % patch -p1 < /usr/src/jfs1020/jfs-2.4-18-patch % cp /usr/src/jfs1020/jfs-2.4-1.0.20.tar.gz . % tar zxvf jfs-2.4-1.0.20.tar.gz
Configure the kernel and enable JFS by going to the Filesystems section of the configuration menu and enabling JFS support, CONFIG_JFS_FS=y. You also have the option to configure JFS as a module. In this case you need only to recompile and re-install kernel modules:
% make modules && make install_modulesOtherwise, if you configured the JFS option as kernel built-in, you need to recompile the kernel (in /usr/src/linux):
% make dep && make clean && make bzImageThen, recompile and install modules (only if you added other options as modules):
% make modules && make modules_installFinally, install the new kernel:
% cp arch/i386/boot/bzImage /boot/bzImage-jfs % cp System.map /boot/System.map-jfs % ln -s /boot/System.map-jfs /boot/System.mapDon't forget to run lilo. (If you have never recompiled the kernel, read the Kernel-HOWTO to learn how.)
After you compile and install the kernel, you should compile and install the JFS utilities. Save the jfsutils-1.0.20.tar.gz file into /usr/src/jfs1020 and then:
% tar zxvf jfsutils-1.0.20.tar.gz % cd jfsutils-1.0.20 % ./configure % make && make install
Having built and installed the JFS utilities, the next step is to create a JFS partition. In the following example, we use a spare partition; the next section will demonstrate how to migrate an existing partition into JFS.
If there is unpartitioned space on the disk, you can create a partition using fdisk. In our test system, we had /dev/hdb3 as a spare partition, so we formatted it as a JFS partition. After the partition is created, reboot the system to make sure the new partition is able to create the JFS.
To create the JFS, apply the following command:
% mkfs.jfs /dev/hdb3
After the filesystem has been created, you need to mount it. To get a mount point, create a new empty directory, such as /mnt/jfs, and use the following mount command:
% mount -t jfs /dev/hdb3 /mnt/jfsWhen the filesystem is mounted, you are ready to try out JFS.
To unmount JFS, simply use the umount command with the same mount point as before:
% umount /mnt/jfs