I have a server that runs centos 6.2 with a samba share.

What i am trying to achieve is to have the samba share automatically mounted on my PC running Fedora 15.

In /etc/fstab I have

//     /media/ant              cifs    gid=users,file_mode=0664,dir_mode=0775,auto,username=***,password=***  0 0

The above works perfectly when I save and run mount -a , now the problem comes in when I reboot my Fedora PC, then the drive is not mounted when the server is running. I can run mount -a but this does not mount the samba share, when I open /etc/fstab and then mount -a then it mounts again

is there a way to have this share auto mounted on boot? Or did I miss something?

  • 2
    Did you try the _netdev option? – quanta Jul 30 '12 at 12:28
  • @quanta - What is _netdev? – Elitmiar Jul 30 '12 at 15:10
  • bit.ly/NfjgQF – quanta Jul 30 '12 at 15:15
  • _netdev is a mount option recognized by the mount command. According to the man page for mount it should be used when "the filesystem resides on a device that requires network access (used to prevent the system from attempting to mount these filesystems until the network has been enabled on the system)." – Starfish Aug 1 '12 at 16:41
  • What does the output of grep /media/ant /var/log/boot.log say? – Starfish Aug 1 '12 at 16:42

Better use autofs (automount). http://www.howtoforge.com/accessing_windows_or_samba_shares_using_autofs

| improve this answer | |

Similar issue as this question.

You'll want to enable the netfs daemon on your Fedora system. This daemon can be used automount/unmount network file services (SMB, CIFS, NFS) defined in the /etc/fstab file.

Use either the ntsysv menu or chkconfig netfs on command to enable it.

This will fix your problem.

| improve this answer | |

Just for clarity, when you say "at boot" do you mean having it mounted once the system has loaded, or when someone has logged in?

Have you considered making that code a bash script and running it with cron @reboot?

Or, copying it to /etc/init.d and making a service of it that starts at boot?

| improve this answer | |
  • Yes, basically the scenario is I have a HP Microserver running Centos 6.2 with a samba share running. As soon as I connect my Laptop to my Home Network I want the Samba share to be mounted immediately – Elitmiar Aug 2 '12 at 6:36
  • If I understand correctly.. that is a very different question than above.. If the device is not present at boot, of course it won't mount.. plugging something into the network and mounting once it is there will require a different approach. – David Aug 2 '12 at 15:09
  • @Roland That's definitely a completely different question, and requires a different answer. If you'd asked that question in the first place, you probably could have saved yourself a lot of trouble (and 50 rep). – Michael Hampton Aug 5 '12 at 16:38

Isn't /media a tmpfs in Fedora 15? Have you tried to mount it in another mount point which a normal directory (i.e. /mnt)?

Sorry for answering with questions, I cannot comment yet.

Also the _netdev and networkmanager suggestions made above should help for getting it right.

| improve this answer | |
  • @Roland, have you tried any of our suggestions? could you please give some feedback ? Thanks. – tripledes Aug 2 '12 at 9:13

Your configuration is OK.

You can try to delay network targets to mount (and also and other network services) after NetworkMananger start, with:

systemctl enable NetworkManager-wait-online.service

In addition you can add the _netdev parameter to prevent the system from attempting to mount these filesystems until the network has been enabled.


https://bugzilla.redhat.com/show_bug.cgi?id=692008 (NFS)

https://bugzilla.redhat.com/show_bug.cgi?id=744399 (SAMBA)

http://linux.die.net/man/8/mount (find _netdev)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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