Table of Contents

NFS

Network file system allows us to share files over the network.

Debian server

apt-get install rpcbind nfs-common nfs-kernel-server 
sed -i 's/NEED_IDMAPD=$/NEED_IDMAPD=YES/' /etc/default/nfs-common
/etc/init.d/rpcbind restart
/etc/init.d/nfs-common restart
/etc/init.d/nfs-kernel-server restart
echo "/embedded $CLIENTADDRESS(rw,no_subtree_check,no_root_squash,async)" >> /etc/exports
exportfs -a

OpenWRT client

modprobe nfsv3
modprobe nfs
mkdir -p /embedded
mount.nfs $SERVERADDRESS:/embedded /embedded -o nolock

Debian client

apt-get install rpcbind nfs-common
sed -i 's/NEED_IDMAPD=$/NEED_IDMAPD=YES/' /etc/default/nfs-common
mkdir -p /embedded
echo "$SERVERADDRESS:/embedded /embedded nfs rw 0 0" >> /etc/fstab
/etc/init.d/rpcbind restart
/etc/init.d/nfs-common restart
mount -a

Void Linux client

xbps-install nfs-utils
echo "blacklist rpcsec_gss_krb5" >> /etc/modprobe.d/modprobe.conf 
mkdir -p /embedded
echo "$SERVERADDRESS:/embedded /embedded nfs rw,noatime,noauto 0 0" >> /etc/fstab
echo "rpc_pipefs /var/lib/nfs/rpc_pipefs rpc_pipefs defaults 0 0" >> /etc/fstab

mkdir -p /etc/sv/rpcbind
echo "#\!/bin/sh\nexec rpcbind -f" > /etc/sv/rpcbind/run
chmod +x /etc/sv/rpcbind/run
ln -s /etc/sv/rpcbind /var/service

mkdir -p /etc/sv/rpc.idmapd
echo "#\!/bin/sh\nexec rpc.idmapd -f" >> /etc/sv/rpc.idmapd/run
chmod +x /etc/sv/rpc.idmapd/run
ln -s /etc/sv/rpc.idmapd /var/service

mount rpc_pipefs
mount $SERVERADDRESS:/embedded

Debian autofs

One you have an NFS client working you can remove the entry in fstab and use autofs to mount it instead.

apt-get install autofs
echo "/- /etc/auto.data" >> /etc/auto.master
echo "/embedded -fstype=nfs $SERVERADDRESS:/embedded" >> /etc/auto.data
/etc/init.d/autofs restart