From charlesreid1

(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......")
 
Line 29: Line 29:


Samba shares can be added to <code>/etc/fstab</code> similarly:
Samba shares can be added to <code>/etc/fstab</code> similarly:
<pre>
//10.5.5.5/Documents  /samba  cifs  username=asdfasdfasdfasdf  0  0
</pre>
=manually mounting network shares=
perhaps you don't want network shares to AUTOMATICALLY mount. in that case, you can add the <code>noauto</code> option, like this:
For NFS:
<pre>
10.5.5.5:/share/documents /mnt/documents nfs users,rw,noauto,nolock,x-systemd.device-timout=10, 0 0 0
</pre>
for Samba:
<pre>
//10.5.5.5/Documents  /samba  cifs  noauto,username=asdfasdfasdfasdf  0  0
</pre>

Revision as of 20:19, 13 March 2016

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:

//10.5.5.5/Documents  /samba  cifs  username=asdfasdfasdfasdf  0  0

manually mounting network shares

perhaps you don't want network shares to AUTOMATICALLY mount. in that case, you can add the noauto option, like this:

For NFS:

10.5.5.5:/share/documents /mnt/documents nfs users,rw,noauto,nolock,x-systemd.device-timout=10, 0 0 0

for Samba:

//10.5.5.5/Documents  /samba  cifs  noauto,username=asdfasdfasdfasdf  0  0