This post is roughly 11 years old; originally published on July 26, 2013! The information presented here may be out of date and inaccurate.
I have an NFS server at home and at work we have Windows (not Samba) servers.
When I first switched to systemd
I noticed that boot and shutdown were
seriously delayed while NFS and CIFS were mounted/unmounted. systemd
was
designed to eliminate those kinds of delays, so I did some research to find
out how to correctly mount NFS and CIFS using systemd
.
Below are some example /etc/fstab
entries for NFS and CIFS mounts that are
systemd
friendly, the pertinent mount options are:
noauto,x-systemd.automount,_netdev
I found that noauto,x-systemd.automount
improved the boot performance and
_netdev
improved the shutdown performance.
This is typically what I have use for mounting my home NAS.
nfs-server:/SomeData /media/SomeData nfs defaults,noauto,x-systemd.automount,_netdev,noatime 0 0
This is what I use at work to work correctly with Windows Server.
//cifs-server/MoreData /media/MoreData cifs defaults,noauto,x-systemd.automount,_netdev,rw,noperm,credentials=/home/username/.smb-credentials 0 0
The contents of the credentials file looks something like this.
username=yourusername
password=yourpassword
domain=COMPANYDOMAIN