NILFS for Fedora

NILFS2 once got packaged in the official repositories of Fedora 11, but it became unavailable in Fedora 14 since nilfs-utils 2.0 did not support libmount library which was needed to avoid a mount-time error in Fedora 14.

The libmount library was supported since nilfs-utils-2.1, so you have to build nilfs-utils-2.1 from source code to use NILFS2 in Fedora 14 ~Fedora 16. (This problem was resolved in Fedora 17).

In addition, the kernel module of NILFS2 became unavailable in kernel package of Fedora 15 and later. To use NILFS in these releases, user needs to build and install NILFS2 kernel module manually.

Building and Installing NILFS2 Kernel Module

The following steps show how to build and install the NILFS2 module on Fedora 15 and later. For details on the custom build of kernel packages, please see http://fedoraproject.org/wiki/Building_a_custom_kernel.

  1. Confirm NILFS2 module

    First, confirm if the NILFS2 module is present or not in the current configuration. modinfo command can be used for this. If it's not present, the following error message will be output.

    $ modinfo nilfs2
    ERROR: modinfo: could not find module nilfs2
    
  2. Install requisite packages

    Install the following packages as preparation:

    $ sudo yum -y install rpmdevtools yum-utils kernel-devel
    

    If you are using a PAE kernel, kernel-PAE-devel package will be needed instead of kernel-devel.

  3. Create rpmbuild tree

    Run rpmdev-setuptree command with a user privilege. This command will setup an "rpmbuild" tree in the home directory.

    $ cd
    $ rpmdev-setuptree
    
  4. Download kernel source package

    Run yumdownloader command to download a kernel source package.

    $ yumdownloader --source kernel
    

    If the version of the acquired package differs with the kernel version you are using, specify the target version explicitly.

    $ yumdownloader --source kernel-3.3.4-3.fc16
    
  5. Prepare to make kernel module

    Run yum-builddep command to install packages on which the kernel source package depends.

    $ sudo yum-builddep -y kernel-3.3.4-3.fc16.src.rpm
    

    Next, expand the kernel source package with a user privilege.

    $ rpm -Uvh kernel-3.3.4-3.fc16.src.rpm
        1:kernel                 warning: user mockbuild does not 
    exist - using root
    warning: group mockbuild does not exist - using root
    ...
    

    Then, execute rpmbuild command to make a source tree for build.

    $ rpmbuild -bp --target=`uname -m` ~/rpmbuild/SPECS/kernel.spec
    
  6. Make and install NILFS2 module

    Run make command at "fs/nilfs2" directory in the kernel source tree. The following arguments are used to build kernel module partially in the NILFS2 directory:

    $ cd ~/rpmbuild/BUILD/kernel-3.3.fc16/linux-3.3.i686
    $ cd fs/nilfs2
    $ make -C /lib/modules/`uname -r`/build M=`pwd` CONFIG_NILFS2_FS=m modules
    

    On error, please confirm whether a kernel tree with the corresponding version is installed in /usr/src/kernels directory.

    On success, do "make modules_install" as follows with the administrator privilege.

    $ sudo make -C /lib/modules/`uname -r`/build M=`pwd` CONFIG_NILFS2_FS=m 
    modules_install
    
  7. Confirm installed module

    Confirm that the NILFS2 module is installed in a proper directory under /lib/modules, with the modinfo command:

    $ modinfo nilfs2
    filename:       /lib/modules/3.3.4-3.fc16.i686/extra/nilfs2.ko
    license:        GPL
    description:    A New Implementation of the Log-structured Filesystem 
    (NILFS)
    author:         NTT Corp.
    depends:        
    vermagic:       3.3.4-3.fc16.i686 SMP mod_unload 686 
    

Disabling SELinux

If SELinux is enabled, write access to NILFS volumes will fail. To avoid this issue, change SELinux to permissive mode with the following command:

$ sudo setenforce 0

To disable SELinux continually, user needs rewriting the config file of SELinux. (A reboot is required to reflect the change).

$ sudo vi /etc/sysconfig/selinux
(Edit the line begining with "SELINUX=")
#
SELINUX=disabled
#
..

$ sudo reboot

Good luck.