Where is the best place for "mount" commands?

David G. Miller dave at davenjudy.org
Wed May 3 14:15:06 UTC 2006


WipeOut <wipe_out at users.sourceforge.net> wrote: 

>I have a number mounts I need for network shares on my samba server.. I 
>would like the mount commands to run when I login..
>
>Where is the best place for a "login script" type thing in a Linux system?
>
>I have read mention of using rc.local, .bashrc and .profile files but 
>haven't found anything conclusive as to what the "right" way to do it is..
>
>Any advice would be appreciated..
>
>  
>
/etc/fstab for either things you want mounted automatically at boot (use 
the "auto" option) or things you want to easily mount from the command 
line (fully define the mount but use the "noauto" option).  Also, this 
is a system resource so every user sees the same definitions.

rc.local is a good place to put actual mount commands for things you 
want mounted automatically at boot but don't want a problem with the 
mount to hold up your boot process.  My server uses RAID 1 for all mount 
points critical for operation and these are automatically  mounted 
through fstab but I have a large non-RAID scratch area that I define 
noauto in fstab and then mount with a mount command in rc.local.  Like 
/etc/fstab, this is a system resource so it acts the same for everybody.

.profile (or .login for csh folks) is the place for stuff that is user 
mountable and you want to have mounted when the user logs in.  .bashrc 
is sourced for each new shell but .profile is only sourced at the 
initial login and you probably don't want to mount these each time the 
user opens a new command shell.  .profile is specific to each user so 
you can customize which share(s) get mounted for a particular user.

Cheers,
Dave




More information about the fedora-list mailing list