How do I install 12.04 onto a nilfs root partition?

Solution 1:

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.

Solution 2:

Essentially you cannot do this as yet because the installer does not support it.

It may technically be possible to transfer an installation from say, EXT4, to NILFS (installing to a partition then transferring to the NILFS partition), but you would also need a separate boot partition (and as you can see this becomes increasingly complicated).

In essence, the answer is "you can't", for now. Also, remember NILFS is rather new, so support for a move like this is unlikely.