Tuesday, April 21, 2009

NilFS: tutorial

Nilfs is a LFS that NTT(Nippon Telegraph and Telephone Corp.) Group distributed to the Linux world. 

It has been merged into Linux mainline 2.6.30 rc-1

Below is the tutorial of how to set up a LFS partition in a VMware VM.

1. Attach multiple virtual disks to the VM in VMware

Editing virutal machine settings ->  add -> add a hard disk

 2. Install a CentOS5.1 distro in the VM and run the more than 260 updates 
(It is said CentOS5.1/5.2 are both OK. But CentOS5.0 needs to be patched.)

root : centos


3. Download the NilFS kmod and utils rpms from nilfs.org site.



Look for the nilfs utilities : nilfs-utils-2.0.12-1.i386.rpm 
Look for the exact kernel version 2.8.18_128 : kmod-nilfs-2.0.12-2.2.6.18_128.1.6.el5.i686.rpm

the utilities and the kernel module version should match the same nilfs version and also the centos kernel version.

(It also includes PAE and Xen rpm packages in the same directory)

4. Install the NilFS rpm package

root: ~>rpm -Uvh  kmod-nilfs-2.0.12-2.6.18_128.1.6.el5.i686.rpm

5. Format the virtual disk as nilFS and mount to the system.
(The extra disk is /dev/hda)

Format the disk by mkfs command
root: ~>mkfs -t nilfs2  /dev/hda
mount the LFS disk by mount command
root: ~>mount -t nilfs2   /dev/hda      /root/nilfs



6. Use the nilFS to recover the data

Before you make some changes, you can set a checkpoint by mkcp
root: ~>mkcp
root: ~>lscp   (lscp will show what checkpoints you have)


After you make the changes, you sjhould  make the previous checkpoint to be a snapshot and then mount that previous snapshot to a new spot
root: ~>chcp  ss  5
root: ~>mount -t  nilfs2 -r -0 cp=5   /dev/hda   /root/nilfs-cp

 



nilfs.org website instructions are at the link  http://www.nilfs.org/en/about_nilfs.html (how to use nilfs --incomplete)




7. Umount nilFS disk
root: ~>umount     /root/nilfs-cp
root: ~>umount    /root/nilfs

Next --> Setup NilFS in a Xen Guest