meta data for this page

cachefilesd

NFS

FS cache is not used:

$ cat /proc/fs/nfsfs/volumes 
 
NV SERVER   PORT DEV          FSID                              FSC
v4 c0a84190  801 0:258        7e59ad2c8fec4a2b:93201b279cd3026b no 

Install FS cache:

sudo apt install cachefilesd -y

Enable it:

/etc/default/cachefilesd
# Defaults for cachefilesd initscript
# sourced by /etc/init.d/cachefilesd
 
# You must uncomment the run=yes line below for cachefilesd to start.
# Before doing so, please read /usr/share/doc/cachefilesd/howto.txt.gz as
# extended user attributes need to be enabled on the cache filesystem.
RUN=yes
 
# Additional options that are passed to the Daemon.
DAEMON_OPTS=""
$ cat /proc/fs/fscache/stats
 
FS-Cache statistics
Cookies: n=0 v=0 vcol=0 voom=0
Acquire: n=0 ok=0 oom=0
LRU    : n=0 exp=0 rmv=0 drp=0 at=0
Invals : n=0
Updates: n=0 rsz=0 rsn=0
Relinqs: n=0 rtr=0 drop=0
NoSpace: nwr=0 ncr=0 cull=0
IO     : rd=0 wr=0
RdHelp : RA=0 RP=0 WB=0 WBZ=0 rr=0 sr=0
RdHelp : ZR=0 sh=0 sk=0
RdHelp : DL=0 ds=0 df=0 di=0
RdHelp : RD=0 rs=0 rf=0
RdHelp : WR=0 ws=0 wf=0

Modify mount option for NFS and add -o fsc. Mount it again.

issues

errno 95 (Operation not supported)

About to bind cache
CacheFiles bind failed: errno 95 (Operation not supported)

When /var/cache/fscache is located on ZFS. See“ Missing features w/ cachefilesd & zfs-0.8.4 on ubuntu/post 20.04, getting EBADF & EOPNOTSUPP #10473

Workaround1: put in on different FS.

No possibility to use tmpfs because: Running cachefilesd cache on ramdisk (tmpfs) for PXE NFS boot

zfs create 
zfs create -V 5gb ssdpool/var/cache/fscache
mkfs.ext4 /dev/zvol/ssdpool/var/cache/fscache
blkid /dev/zvol/ssdpool/var/cache/fscache
 
/dev/zvol/ssdpool/var/cache/fscache: UUID="1924bc34-6503-40bd-b32f-359191f62c6a" BLOCK_SIZE="4096" TYPE="ext4"
/etc/fstab
UUID=1924bc34-6503-40bd-b32f-359191f62c6a  /var/cache/fscache ext4 errors=remount-ro,relatime 0       0