From charlesreid1

Revision as of 20:16, 13 March 2016 by Admin (talk | contribs) (Created page with "=automounting network shares via /etc/fstab= With the usual caveats to be careful editing the /etc/fstab file, as you can disable your ability to boot with a single typo......")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

automounting network shares via /etc/fstab

With the usual caveats to be careful editing the /etc/fstab file, as you can disable your ability to boot with a single typo...

fstab

Start with your existing /etc/fstab file. Here is a sample:

# root filesystem
UUID=9f60d333-5a92-4e27-a83a-52f4a033cebf       /                   ext4            errors=remount-ro           0 1
# swap
UUID=c9139e0a-19b0-4478-a86e-a5d0ee4f74a4       none                swap            sw                          0 0

adding nfs to fstab

Add the files to include the NFS share:

10.5.5.5:/share/documents /mnt/documents  nfs  users,rw,auto,nolock,x-systemd.automount,x-systemd.device-timeout=10 0 0

This accesses the NFS shares at the IP address 10.5.5.5, specifically the ones at /share/documents, and mounts them locally at /mnt/documents.

The various options do things like telling to keep the drive mounted if possible, not to wait longer than 10 seconds for the share if it is unavailable on the network, and end the line with 0 to indicate no consistency check is needed on boot. (systemd is required for the x-systemd.automount option to be understood).

adding samba to fstab

Samba shares can be added to /etc/fstab similarly: