Ubuntu: I want to execute a mount command when my computer boots up, where/how do I do that?

Looking at fstab, how would I run the command:

mount -t cifs -o username=Web,password=asdf,gid=Web,dir_mode=0777,file_mode=0777 //192.168.15.10/Web /dev/fileserver
link|improve this question

75% accept rate
1  
This nature of question probably belongs on SuperUser, and if you wait it will be automatically moved by other users if they vote to "close" it there. – Bart Silverstrim Nov 3 '10 at 14:39
feedback

migrated from serverfault.com Nov 4 '10 at 0:49

This question came from our site for system administrators and desktop support professionals.

3 Answers

up vote 2 down vote accepted

You can use /etc/fstab to handle mounting file systems at startup.

For example, on my laptop I dual boot Windows 7 and Ubuntu 10.04. When I am in Ubuntu I like to be able to access my NTFS partitions. All I do is simply mount my partitions by adding an entry to my fstab like the following:

# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0

# Linux Drives were here (root file system, swap)

UUID=theuuid01  /mount/Windows/SystemReserved   ntfs-3g quiet,defaults,rw,uid=1000,umask=0022   0   0
UUID=theuuid02  /mount/Windows/C    ntfs-3g quiet,defaults,rw,uid=1000,umask=0022   0   0

So on every single bootup I have my Windows Drives available for Read/Write operations with the user id set to my personal one.

Obviously this will work with ext style partitions too, but the NTFS is a tad more complex so it makes a good example. Be sure to read the man pages on fstab for more information

link|improve this answer
feedback

Boot-time mounts are stored in /etc/fstab.

link|improve this answer
Not entirely anymore because of the revamped dynamic mounting used in Linux distros. FSTAB seems to be supported just for backward compatibility, and it uses a kind of hardware ID system for adding devices and mounting them. – Bart Silverstrim Nov 3 '10 at 14:38
2  
The dynamic mounting of drives is mostly for removable media like USB drives or CDs/DVDs, and you don't have control of where the volumes get mounted (typically a directory like /media/<volume label). If you want to control where the volumes are mounted you still need to use /etc/fstab. – jcollie Nov 3 '10 at 14:49
feedback

Typically, to mount a drive on bootup, you don't execute an explicit command, you configure the partition in /etc/fstab.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.