I'm PXE-booting a Ubuntu 10.10 system, where I specify the kernel parameters as follows:

append root=/dev/nfs initrd=ubuntu-boot/initrd.img-2.6.35-24-generic
nfsroot=,fsc ip=dhcp rw

I need to use the mount option 'fsc' in order to use FS-cache functionality (the cachefilesd package.) However, when I try this I get the following error upon boot:

nfsmount: bad option 'fsc'

Why doesn't nfsmount permit this option? (It works fine when you mount manually with mount -o fsc after booting up.)

I changed nfsmount to mount -t nfs in the file /usr/share/initramfs-tools/scripts/nfs and then I ran update-initramfs -u to update the initramfs image, but it seems this still gives an error:

mount: unknown nfs mount option 'fsc'

My guess would be that this is a limitation of the mount functionality in klibc. What would be the best way to address this? Does the nfsmount program need to be patched?

Since this seems to be a limitation of the nfsmount tool in klibc, I was thinking that I could add /sbin/mount.nfs to the initramfs image and mount the nfsroot with this tool instead. I copied it into the folder /usr/lib/klibc/bin and I updated the script /usr/share/initramfs-tools/scripts/nfs as follows:

mount.nfs ${NFSROOT} ${rootmnt} -o nolock ${roflag} ${NFSOPTS}

After booting the updated initramfs image, there is a long delay when mount.nfs is executed and then the following message is displayed:

mount.nfs: an incorrect mount option was specified  
Begin: Retrying nfs mount ... Begin: Running /scripts/nfs-premount ... done.

However, this message is displayed no matter what mount options I use, so it appears to be a different problem altogether...


I finally manged to solve it. Here are the steps:

  1. Add mount.nfs from Ubuntu 10.04 to the initramfs image (copy it into the /usr/lib/klibc/bin folder.)
  2. Change the nfsmount line in /usr/share/initramfs-tools/scripts/nfs to:

    mount.nfs ${NFSROOT} ${rootmnt} -o nolock ${roflag} ${NFSOPTS}
  3. Update the initramfs image with either mkinitramfs or update-initramfs.

This would enable the fsc option on the nfsroot for my Ubuntu 10.10 system. I have no idea why I'm not able to use mount.nfs from 10.10 though -- perhaps a regression?

  • Ah, good idea! :-) – meanderix Feb 7 '11 at 18:56

Recently I was building a new nfsroot based on 16.04 and decided to take another look at using cachefilesd for the nfsroot file system. Yet again I stumbled on this post. It helped to get me pointed in the right direction, and I ended up getting it to work but I believe I have a better answer than the one posted here.

While meanderix's steps could work I don't think its the best way. So here are my steps:

  1. In /usr/share/initramfs-tools/hooks create a new file. I called mine fsc for file system cache.
  2. Add the following content to your file:

    set -e
    prereqs () {
            echo "${PREREQ}"
    case "${1}" in
                    exit 0
    . /usr/share/initramfs-tools/hook-functions
    copy_exec /sbin/mount.nfs /sbin
    exit 0
  3. Make the fsc file executable:

    chmod 755 /usr/share/initramfs-tools/hooks/fsc
  4. Modify /usr/share/initramfs-tools/scripts/nfs as meanderix suggests.

  5. Generate your initramfs. eg:

    mkinitramfs -o /fscinitrd

The difference and the real magic here is the /usr/share/initramfs-tools/hooks/fsc file. Particularly the copy_exec line. When the initial RAM disk is created it will automatically add mount.nfs to the initramfs. But wait there's more! It will also determine the libraries needed and add them for you too. That's really cool since on Ubuntu 16.04 I needed libtirpc.so since mount.nfs was dependent on it and this added those dependencies for me.

After doing this and configuring cachefilesd I now have file system caching for my NFSROOT and that's just awesome.


The kernel has not been compiled with that module (CONFIG_NFS_FSCACHE in kernel config). And a link to a guide for that: Ubuntu Kernel/Compile

  • It is compiled with it, I use the feature all the time (but just in /etc/fstab), I suspect maybe the nfsmount tool in userspace doesn't support this or something? – Jorge Castro Jan 28 '11 at 22:06
  • I found the following bug report that seems to indicate that it has been added in Maverick: bugs.launchpad.net/ubuntu/+source/linux/+bug/440522 – meanderix Jan 28 '11 at 23:06
  • My fstab entry also specifies the fsc option, but it seems to be ignored: /dev/nfs / nfs fsc 1 1 – meanderix Jan 28 '11 at 23:08
  • Thanks, Jorge and meanderix. Mysterious. Interesting. Seems like a bounty question? This is a great feature to get working right. – user8290 Jan 28 '11 at 23:43
  • I'm new in this community, but if it's possible to promote the question I think that would be great. – meanderix Jan 28 '11 at 23:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.