3

I already added the remote directories I want mounted at startup in /etc/fstab, but when I reboot, they don't get mounted.

If I run mount -a it all works, but it appears that mount -a doesn't get executed at boot. Is there something I need to enable in order to have them mounted by default?

My fstab looks like this:

/dev/sda1 / ext3 defaults 1 1
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
10.46.7.232:/var/www/html/images /var/www/html/images nfs rw 0 0
10.46.7.232:/var/www/html/files /var/www/html/sites/default/files nfs rw 0 0
10.190.53.183:/var/www/thumbnails/uploads /var/www/html/uploads nfs rw 0 0
10.46.7.232:/var/www/html/vizbox /var/www/html/vizbox nfs rw 0 0

and I am running CentOS 5.8

Eduard Luca
  • 371
  • 2
  • 9
  • 18

3 Answers3

5

Ensure that the netfs service is enabled. Use either ntsysv or chkconfig to enable it.

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

Your network's not up at the time of running fstab, just add a 'mount -a' at the end of your rc.local.

Chopper3
  • 100,240
  • 9
  • 106
  • 238
2

I always go on about it but is there a reason you're not/can't use autofs? That way it would mount the NFS shares on demand, not just during startup.

To keep it simple you do do something like

/etc/auto.master

/net auto.net

/etc/auto.net

10.46.7.232:/var/www/html/images images 
10.46.7.232:/var/www/html/files files 
10.190.53.183:/var/www/thumbnails/uploads uploads 
10.46.7.232:/var/www/html/vizbox vizbox 

And then set up a load of symlinks

ln -s /var/www/html/images /net/images
ln -s /var/www/html/sites/default/files /net/files
ln -s /var/www/html/uploads /net/uploads
ln -s /var/www/html/vizbox /net/vizbox

And finally

service autofs restart

You'll get all kinds of good things like automatically recovering when the NFS server goes down, insulation from errors when the NFS server is not in use.

happyhairydude
  • 306
  • 2
  • 8
  • it's a more complex setup. I think netfs works well, but autofs is a good long-term move. – ewwhite Jul 31 '12 at 22:02
  • It's funny how perspectives differ, I only use autofs now. I reckon it's nearly as easy to set up as fstab entries and it gets rid of so many other issues. The messing around with symlinks isn't ideal I guess... – happyhairydude Aug 02 '12 at 12:40