I have a mount command that I want executed every single time the computer reboots so that the folder is always mounted when I need it. What file would I have to edit in order to accomplish this?
You can just write a line in /etc/fstab to mount the device:
The following example will mount sda8 (an ext4 filesystem) automatically under the mountpoint /data:
/dev/sda8 /data ext4 defaults 1 2
- you have to be root to edit /etc/fstab
abacabb, you did not specify what you are trying to mount. please_try_again has specified the most direct approach with an example. In order to edit your fstab file, if you use the KDE desktop, you would use this command:
kdesu kwrite /etc/fstab
However what I wanted to add was that you can use the YaST / System / Partitioner to add the drive and its folder for you automatically. Once fired up (The Partitioner, You must answer Yes to the first question), and with your new drive or partition attached beforehand, find the new drive/partition in the listing on the right window as sdb or sdc (or what ever it is called) and right click on it and select add partition. In the add partition window, select the partition type and elect to format it if it is not formatted. The default for existing partitions is to NOT format them. I use ext4 for new Linux partitions and NTFS for new Windows partitions, but you can not create a NTFS partition here and must do that in Windows if you wanted that. Finally, at the bottom is a mount selection point. Here is where you add where to be mounted, like /Software or /data for instance. The cool part is once done with the Partitioner, your drive will be added to the fstab file for you automatically, ready for your next reboot and mounted for you the moment you exit the partition program, ready for use right away.
Thank You,
It’s a windows share that I’m mounting. I’m using the mount -t cifs command.
On 2010-10-29 16:06, abacabb wrote:
>
> It’s a windows share that I’m mounting. I’m using the mount -t cifs
> command.
Then you could define the mount in “/etc/samba/smbfstab”. It may require you to enable service
“/etc/init.d/smbfs”
If that doesn’t work, and you want to use an script, the quickest place is “/etc/init.d/after.local”.
–
Cheers / Saludos,
Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)
I found the file /etc/init.d/boot.local
Thanks though!
On 2010-10-30 16:06, abacabb wrote:
>
> I found the file /etc/init.d/boot.local
That one will not work. Do what I said.
–
Cheers / Saludos,
Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)
My distro does not seem to have an after.local. I did a “find / -name after.local” and nothing came up. As far as samba, not running samba on that machine. It’s not an option for my scenario.
any ideas?
That file doesn’t exist by default. You have to create it
#!/bin/sh
#
# /etc/init.d/rclocal
#
# rc.local replacement for openSUSE
#
### BEGIN INIT INFO
# Provides: rclocal
# Required-Start: cifs
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start: 3 5
# Default-Stop:
# Description: rc.local equivalent
### END INIT INFO
# Source SuSE config
. /etc/rc.status
case "$1" in
start)
# Add your commands below!
;;
stop)
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 start
# Remember status and be quiet
rc_status
;;
status)
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
rc_exit
copy/paste the code above, add your commands, save as /etc/rc.d/rclocal (or /etc/rc.d/after.local or any name you like), then, as root, do the following to enable it:
chmod 754 /etc/rc.d/rclocal
chown root:root /etc/rc.d/rclocal
insserv rclocal
On 2010-10-31 01:06, please try again wrote:
>
> abacabb;2246239 Wrote:
>> My distro does not seem to have an after.local. I did a “find / -name
>> after.local” and nothing came up. As far as samba, not running samba on
>> that machine. It’s not an option for my scenario.
>> any ideas?
>
> That file doesn’t exist by default. You have to create it
Why the sad smiley? Of course it does not exist, it is your local file,
your property, YOU create it. With any content you wish, as long as it
is a valid bash script.
Just create the file, make it executable, done. It will automatically
run at the end of the sequence.
> Code:
> --------------------
> #!/bin/sh
> #
> # /etc/init.d/rclocal
…
> copy/paste the code above, add your commands, save as /etc/rc.d/rclocal
> (or /etc/rc.d/after.local or any name you like), then, as root, do the
> following to enable it:
No, no, don’t use rclocal on a suse system. Use suse methods. And don’t
try to insert an after.local file, it will run twice.
–
Cheers / Saludos,
Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)
On 2010-10-30 21:06, abacabb wrote:
> My distro does not seem to have an after.local. I did a “find / -name
> after.local” and nothing came up. As far as samba, not running samba on
> that machine. It’s not an option for my scenario.
Yes, you are running samba. You are running “mount -t cifs”, which is
part of samba. The client side, not the server.
–
Cheers / Saludos,
Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)