2

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
0

3 Answers 3

2

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

2

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

2
  • 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. Nov 3, 2010 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, 2010 at 14:49
1

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

You must log in to answer this question.

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