Ubuntu – How to install 12.04 onto a nilfs root partition


I have a brand new SSD and I'd like to install 12.04 onto it with nilfs as the filesystem for the root partition.

I can't find any easy way of doing that. If I boot from the 12.04 LiveCD, I can install nilfs-tools (I had to download it via wget — I couldn't seem to apt-get it) and I was able to format a partition as nilfs via mkfs.nilfs.

However, when I click "install Ubuntu" and start the installer and tell it I want to choose the partition, it wants to reformat it and only gives me options for other filesystems (reiser, ext, etc.) but no nilfs, even though nilfs support has been installed (I was able to create a nilfs filesystem on my partition).

Any tips or suggestions?

Best Answer

  • As Roland Taylor pointed out, you can first install to an ext4 partition using the installer, then transfer it to a nilfs partition.

    Prepare a free partition for the system. It will be mounted as /, let's call it NILFS.

    And you need another partition for installing Ubuntu, it can be a usb-disk or another partition on the disk, let's call it EXT.

    You don't need a separated /boot partition, as grub 1.99 shipped with Ubuntu 12.04 already supports boot from nilfs2 file system.

    Prepare the system

    You do a normal Ubuntu install to EXT.

    Install nilfs-tools, and format the free partition to nilfs2.

    By default, Ubuntu's initramfs doesn't have the nilfs kernel module in it.

    You need to regenerating it:

    sudo echo nilfs2 >> /etc/initramfs-tools/modules
    sudo update-initramfs -u

    Transfer the system

    Boot into Ubuntu 12.04 livecd. Install nilfs-tools. (You need to change sources in Software Center before apt-get install nilfs-tools.)

    Mount EXT and NILFS, then copy your system:

    sudo cp -ax /media/EXT/* /media/NILFS/*

    (You can use rsync instead.)

    Then edit your /media/NILFS/etc/fstab, change the line /. (Change the uuid, ext4->nilfs2. I recommend adding noatime,async,discard mount options for SSD.)

    Then edit your grub configuration and reinstall grub. See Ubuntu Wiki for how to tweak with grub. Note that you need to change your grub config file before reinstalling. I suggest to chroot into NILFS, and just use dpkg-reconfigure to change config and reinstall at once.

    Now you can reboot into your nilfs2 based Ubuntu 12.04! :-)

    Though I've not tested it, but the above instructions should work. In fact, I've used the same method to transfer my Ubuntu 10.04 from ext3 to nilfs2. Since the grub of Ubuntu 10.04 doesn't support booting from nilfs2, I've used ext2 as /boot. But recently I've downloaded Ubuntu 12.04 live cd to test if 12.04 works on my netbook. So just now I've copied /boot/ back into / partition, changed my grub config file and used 12.04's grub-install to re-install grub. And it worked! (So maybe I can turn the useless separated boot partition into a small swap partition?)

    P.S. If you don't like this method, you may try installing via debootstrap. I think it will work too.