NILFS2

Andrew Benton b3nton at gmail.com
Tue Jan 5 16:12:26 PST 2010


Hello,
I've been using one of the newer file systems in the kernel, NILFS2, on 
my Dell netbook. It has some features which work well on flash memory 
but it also has some quirks which made it difficult to set up at first.
When you mount a NILFS2 partition it starts a daemon (/sbin/nilfs-
cleanerd) which deletes old files. The problem is that nilfs-cleanerd 
looks in /proc/mounts to see which device node in /dev it should be 
working on. If you cat /proc/mounts you'll see that / is listed as 
/dev/root which doesn't exist on an LFS system so nilfs-cleanerd quits, 
no garbage collection gets done and the partition fills up until you get 
a "no space left on the device" error. The solution I devised is to 
create a symlink /dev/root pointing at the root partition. This has to 
be done before the filesystem is mounted. The kernel knows where the 
root is because it was passed it as an argument by grub, it's available 
in /proc/cmdline
So I hacked at one of the bootscripts, /etc/rc.d/init.d/mountfs, and 
added a line like this just before it mounts /

ln -s $(awk '{ print $1; print $2; print $3; print $4; print $5 }' 
/proc/cmdline | sed '/dev/!d;s at root=/dev/@@') /dev/root

That works fine and causes no problems, even on systems which don't use 
NILFS2, but it isn't pretty. Is there a simpler way to get awk to print 
all the fields at one go? Or would some other tool (perl?) be more 
appropriate? That's the main reason I wrote this email, for a bit of 
scripting advice.
Ideally I'd like udev to create the symlink, but I don't know how to do 
that. It'd have to grep /proc/cmdline for every disk partition.

Andy



More information about the lfs-dev mailing list