Wednesday, November 26, 2014

LInux - Mount After Network

Linux sucks, Linux is great.  Such a mixed feeling.  On my bleeding edge machine, I deserve what I get.  And all of a sudden, a perfectly good mount in /etc/fstab doesn't work.  It adds insult to injury by taking minutes to boot.

This was hair-ripping time!  I looked everywhere and all I could find was a cifs mount for directories that are already on samba.  My directory was to be shared over samba.  I hate it when Linux decides it knows best.

For Debian, I finally found that there is an if-up.d directory in /etc/network.  This sucker is only invoked after the network is up, and if you have network-manager, it comes up very late indeed.

So, nano a file, I called 'aftermount'.  Here it is.

#mount after network up
mount /dev/sdb1 /disk4
/etc/init.d/smbd restart
/etc/init.d/nmbd restart

I put a religious empty line at the end.  This is run after the network.  After you create file, you have to run 'invoke-rc.d aftermount start >/dev/null', everything while root, or do the sudo thing.  Also chmod a+x aftermount to make it executable.

Then the stupid thing works.  (I write these things for myself in a year).

No comments: