6

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

//192.168.1.104/ant     /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?

Elitmiar
  • 775
  • 3
  • 15
  • 31

5 Answers5

1

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.

ewwhite
  • 194,921
  • 91
  • 434
  • 799
1

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

GioMac
  • 4,444
  • 3
  • 24
  • 41
0

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.

references:

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)

tombolinux
  • 243
  • 1
  • 5
0

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?

David
  • 137
  • 1
  • 1
  • 7
  • 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 02 '12 at 06: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 02 '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 05 '12 at 16:38
0

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.

tripledes
  • 141
  • 1