Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Scenario:
I use the same notebook at work and at home:

  • At work I have 13 NFS mappings split over two different IPs.
  • At home I have one mapping on a third IP.

Problem:
When I get home and turn on the notebook, it takes a long time to boot due to the missing IPs present on my fstab.

Solution:
Maybe there is a way to add conditional blocks on fstab or perhaps use different fstab files depending on the network I am connected to.

Is that possible or is there an alternate solution?

share|improve this question

closed as too localized by jrg Feb 29 '12 at 16:58

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Update your question if you need help with autofs. I need more specific information to write a config for you, but I would be happy to review your config if you pastebin it. –  bodhi.zazen Feb 29 '12 at 5:02
add comment

1 Answer 1

IMO the best solution is autofs.

The syntax of autofs takes a few minutes to comprehend, but once you understand the syntax it is very very easy and very much automated.

The advantage is that your shares are mounted, automatically, seamlessly, but only as needed. So no more slow boots, yet the shares are easily available.

autofs is a program for automatically mounting directories on an as-needed basis. Auto-mounts are mounted only as they are accessed, and are unmounted after a period of inactivity. Because of this, automounting NFS/Samba shares conserves bandwidth and offers better overall performance compared to static mounts via fstab.

Install autofs

sudo apt-get install autofs

You then remove the mounts from /etc/fstab and add them to /etc/auto.master

The syntax is

mount-point [map-type[,format]:] map [options]

For example:

mount-point   -fstype=nfs4   server:/share

You can mount all the shares on a particular server, for example

/media/work-server   /etc/auto.work-server

will mount all the shares on your work server, in the directory /media/work-server as configured in /etc/auto.work-server

If you have a problem, paste bin your configuration file(s) and we can review them.

See : https://help.ubuntu.com/community/Autofs

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.