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.

I have a NAS box that I automount several shares on my laptop. The shares are mounted to /mnt/nas/music, /mnt/nas/photos, etc.

When I browse /mnt/nas in Nautilus, no directories show up unless I go to the location bar and type in the directory name of the mounted share. Is this how autofs works, or should there be directories that always appear, and then when you try to access their contents, autofs will mount the remote share?

Thanks a bunch.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Use the option --ghost in your auto.master. Look at google for an example file, I found this exmaple:

# mount point   config file        options
/-              /etc/auto.direct   --ghost

/misc           /etc/auto.misc     --timeout=30 --ghost

+auto.master

From here: example

share|improve this answer
    
This is what I was looking for! –  user7242 Mar 30 '11 at 13:23

You might be using autofs to mount these directories. If you find the file /etc/auto.master, it means that you probably are. The way autofs works is that it mounts and displays directories only once you try to access them.

Autofs provides flexibilities like pulling from multiple servers, but in your case, you could add static entries to /etc/fstab if you know where these shares are located. For example, if you have a share located at IP address 192.168.1.3 at the directory /content/music, and you want it to be mounted at /mnt/nas/music, you could add an entry like

192.168.1.3:/content/music  /mnt/nas/music  nfs defaults    0   0

Don't forget to remove the appropriate entry from your auto.master!

To mount the new structure without restarting, type:

# service autofs restart
# mount -a
share|improve this answer
    
Maybe I need to clarify. I intentionally set up mounting using autofs to avoid delays at boot from mounting in fstab. I was wondering if it was possible to have an empty directory that autofs mounts to so i can see a list / have reminders of the various directories that i can mount on demand. Hopefully that makes my question clearer. –  user7242 Dec 15 '10 at 4:17
    
Ah. I'm not sure in that case, but I have something in mind that might work. If you have a single server, then you could create a virtual filesystem tree using bind mounts, and export that. Something like nfs4. –  shroff Dec 22 '10 at 9:02
    
Also, in order to avoid delays with /etc/fstab, you could add the _netdev option to nfs binds to signify that they are network devices. This will ensure that init doesn't try to mount them before the NICs are up. –  shroff Dec 22 '10 at 9:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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