Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 // /dev/fileserver
share|improve this question

migrated from Nov 4 '10 at 0:49

This question came from our site for system and network administrators.

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

share|improve this answer

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

share|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
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

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

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .