Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
    
What distribution are you running? –  larsks Jul 31 '12 at 13:14
    
Please post your fstab entry –  RomeNYRR Jul 31 '12 at 13:15
1  
If your network is not yet up at the time that you try to mounts remote directories (NFS?) then that will fail. This would explain why it works at a later time. –  Hennes Jul 31 '12 at 13:16
    
Updated my question with both info. –  Eduard Luca Jul 31 '12 at 13:16
    
Hmmm: is serverfault.com/questions/166224/auto-mount-network-share?rq=1 relavant? I think it is. –  happyhairydude Aug 3 '12 at 11:26

3 Answers 3

up vote 5 down vote accepted

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

share|improve this answer
    
Will definitely try that. –  Eduard Luca Jul 31 '12 at 13:25
    
Did netfs work for you? –  ewwhite Jul 31 '12 at 22:01

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

share|improve this answer

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.

share|improve this answer
    
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 2 '12 at 12:40

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.