I have a partition mounted with mount -t ext3 /dev/sda3 /foo
.
Each time I reboot, I need to remount. How can I keep this mounted after every reboot?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
Sign up to join this communityI have a partition mounted with mount -t ext3 /dev/sda3 /foo
.
Each time I reboot, I need to remount. How can I keep this mounted after every reboot?
You need to make an entry in /etc/fstab
for the mount, something like:
/dev/sda3 /foo ext3 defaults 1 1
For more information see:
nofail
flag so that you'll able to normally boot your system when /dev/sda3
is not able to mount for some reason.
– styrofoam fly
Oct 12 '18 at 14:29
Sometimes, one may face critical issues due to /etc/fstab
entries. So, the alternative is crontab.
Just add below entry in root's crontab.
$ sudo crontab -e
@reboot mount -t ext3 /dev/sda3 /foo
@reboot
makes sense to me. Perhaps in combination with a fstab noauto
row, or mount
directly in the crontab. — Anyway, upvoted from -3 to -2, because this answer is actually useful, in some rare cases. (And edit suggestoin: "sometimes" --> "in rare cases" :- ) )
– KajMagnus
Jul 23 '16 at 14:33
@reboot echo '/opt/ed/mount-google-cloud-storage-backups-bucket.sh >> /opt/ed/cron.log 2>&1' | at now + 3 minutes
, works OK perhaps not for everyone, but for my use case.
– KajMagnus
Jul 23 '16 at 15:29
For OpenSuse, coming from Novell Automatically mount a windows share at boot time with Linux
//winserver/share /mnt/winshare cifs gid=users,file_mode=0664,dir_mode=0775,auto,username=john,password=johnpass 0 0
Please add single quotes if the folder names contains spaces:
'//winserver/share with spaces' '/mnt/winshare with spaces' cifs gid=users,file_mode=0664,dir_mode=0775,auto,username=john,password=johnpass 0 0
Check the end of the article if you don't want to put passwords in fstab.