Install
First thing to do is install the automount package
Code: Select all
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install autofs
Check Files in Package
When I installed autofs on RPi 3 Jessie only two files were installed. If you notice that automount was not installed then you have to get the .deb files from debian and install manually
Code: Select all
$ dpkg-query -L autofs
/.
/etc
/etc/init.d
/etc/init.d/autofs
Get Raspian Version
Code: Select all
$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
Get Architecture
Code: Select all
dpkg --print-architecture
armhf
Download correct version & architecture
Download .deb and install based on your Raspian above
https://packages.debian.org/search?keywords=autofs
Code: Select all
$ cd /tmp
$ wget "wget http://ftp.ca.debian.org/debian/pool/main/a/autofs/autofs_5.0.8-2+deb8u1_armhf.deb"
Remove Old autofs and install autofs_5.0.8-2+deb8u1_armhf.deb
Code: Select all
$ sudo apt-get update
$ sudo apt-get remove autofs --purge
$ sudo dpkg -i autofs_5.0.8-2+deb8u1_armhf.deb
Check for automount files
Code: Select all
$ dpkg-query -L autofs
/.
/etc
/etc/init.d
/etc/init.d/autofs
/usr
/usr/lib
/usr/lib/arm-linux-gnueabihf
/usr/lib/arm-linux-gnueabihf/autofs
...
/usr/sbin
/usr/sbin/automount
...
/usr/lib/arm-linux-gnueabihf/autofs/mount_nfs4.so
Configure
Make mount point directories /mnt/nfs/
Code: Select all
$ mkdir -p /mnt/nfs/mycloud
$ mkdir -p /mnt/nfs/mobilesvr
Edit /etc/auto.master and add a autofs file
Code: Select all
/mnt/nfs/mycloud /etc/mycloud.nfs uid=501,gid=1000 --timeout=6000 --ghost
/mnt/nfs/mobilesvr /etc/mobilesvr.nfs uid=0,gid=0 --timeout=6000 --ghost
Edit /etc/mycloud.nfs and add mount points
The following is a NFS filetype connection.
Code: Select all
storage -fstype=nfs,rw,hard,nolock,noauto,x-systemd.automount 192.168.1.100:/nfs/Storage
Restart Service
Code: Select all
$ systemctl restart autofs.service
Test
Code: Select all
$ l /mnt/nfs/mycloud
file1.txt
file2.jpg
Check Mounts
Code: Select all
$ mount | grep mycloud
/etc/mycloud.nfs on /mnt/nfs/mycloud type autofs (rw,relatime,fd=-1,pgrp=816,timeout=6000,minproto=5,maxproto=5,indirect)
/etc/mycloud.nfs on /mnt/nfs/mycloud type autofs (rw,relatime,fd=7,pgrp=13541,timeout=6000,minproto=5,maxproto=5,indirect)