Navigation

      Tweaking Ubuntu‎ > ‎

      FSTAB

      After reading the The How to Geek about what the FSTAB does in Linux here

      I tried to collect all entries that I think were relevant for this website. Read it here:

       Read about mounting windows partitions here and configuring fstab here

      What is Fstab?
      Fstab is your operating system’s file system table.  If you want a review of file systems, be sure to check out our other article, HTG Explains: Which Linux File System Should You Choose? In the old days, it was the primary way that the system mounted files automatically.  Nowadays, you can plug in a USB drive of any kind and it’ll just pop up in Nautilus like it does in Windows and Mac OS, but once upon a time, you had to manually mount those disks to a specific folder using the “mount” command.  This held true for DVDs, CDs, and even floppies (remember those?).
      Back then, your only alternative was the tell the computer that anytime a specific device was plugged in, it should be automatically mounted in a specific place.  This is where fstab came in, and it was awesome.  Suppose you swapped hard disks on your IDE or SCSI controller.  The computer could load the file systems in a different order, potentially messing things up.  Fstab is configured to look for specific file systems and mount them automatically in a desired way each and every time, preventing a myriad of disasters from occurring.

      Your Fstab File

      The fstab file is located at:
      /etc/fstab
      Edit the file from the terminal with:

      sudo gedit /etc/fstab


      The Obvious Options

      You’ll notice all of the entries begin with UUIDs. Each file system, during formatting, gets assigned a Universally Unique Identifier, which it takes to the grave.  Since it cannot be changed, this is the ideal way to select file systems for mounting, especially for important ones.  Let’s say your /home partition is on a second hard drive and you end up moving it to an external hard drive; fstab will still find that partition and mount it correctly, avoiding a failed boot.  If you switch to (or are stuck using) the old method of using device identifiers to select partitions (i.e. /dev/sda1), this advantage disappears because hard drives and partitions are counted by their controllers, and can thus change.
      Nota: Using UUIDs in your fstab file, while convenient for most home users, does have a few big caveats.  This doesn’t work when using things like “assembled” or “network-based” devices.  If you’re more of an advanced user, or plan on using things like software RAID in the future, you’re better off not using UUIDs.

      The next section of fstab, like all subsequent ones, is separated by either a space or a tab, or a combination of them.  Here, you’ll find the mount point.  As you can see, I have a root (/) mount point, a swap, and two that I manually added in for my shared network storage drives.  If you’re adding an entry to fstab, then you’ll have to manually create the mount point before you restart your computer (and the changes take effect).

      Next is the section which identifies the type of file system on the partition.  Many, such as ext2/3/4, ReiserFS, jFS, etc. are natively read by Linux.  Your particular system may still need to have particular packages installed to be able to read and write to them.  The perfect examples are NTFS partitions; you'll need the ntfs-3g driver to access them.

      The Scarier Stuff
      The next few sections are what usually scare away newcomers, but they’re really not so complicated.  There’s a large set of options available, but there’s a handful or so of very common ones.  Let’s take a look at them. (The default option is first, followed by alternatives, but as Linux distros can be very different, your mileage may vary.)
      • auto/noauto:  Specify whether the partition should be automatically mounted on boot.  You can block specific partitions from mounting at boot-up by using “noauto”.
      • exec/noexec:  Specifies whether the partition can execute binaries.  If you have a scratch partition that you compile on, then this would be useful, or maybe if you have /home on a separate file system.  If you’re concerned about security, change this to “noexec”.
      • ro/rw:  “ro” is read-only, and “rw” is read-write.  If you want to be able to write to a file-system as the user and not as root, you’ll need to have “rw” specified.
      • sync/async:  This one is interesting.  “sync” forces writing to occur immediately on execution of the command, which is ideal for floppies (how much of a geek are you?) and USB drives, but isn’t entirely necessary for internal hard disks.  What “async” does is allow the command to execute over an elapsed time period, perhaps when user activity dies down and the like.  Ever get a message asking to your “wait while changes are being written to the drive?”  This is usually why.
      • nouser/user:  This allows the user to have mounting and unmounting privileges.  An important note is that “user” automatically implies “noexec” so if you need to execute binaries and still mount as a user, be sure to explicitly use “exec” as an option.
      These options are separated by a comma and no spaces, and can be put in any order.  If you’re not sure about the defaults, it’s okay to explicitly state your options.  Things that are mounted from temporary places (like USB) won’t follow this basic pattern unless you created entries for them (by UUID) in fstab.  It’s convenient when you want an external hard drive to always mount in a particular way, because normal thumb-drives and the like won’t be affected.

      You can see that my two storage drives have user mounting privileges enabled, read-write access enabled, and auto-mounting is turned on.  I don’t compile much software, but when I do, I add the “exec” option at the end of the list.
      Dumping and Fscking

      The next option is a binary value (“0” for false and “1” for true) for “dumping.”  This is a pretty much out-dated method of backup for cases when the system went down.  You should leave this as “0”.

      The last option is a numeric value for “passing.”  This tells the system the order in which to fsck, or perform a file system check.  If a disk has an option of “0” it will be skipped, like NTFS-formatted storage drives that will not be checked by fsck.  The root file system should always be “1” and other file systems can go afterward.  This works best for journaling file systems like ext3/4 and ReiserFS.  Older file systems like FAT16/32 and ext2 can take a while, so it’s better to turn their fscking off and do it periodically yourself.

      Samba shares in FSTAB

      A convenient manual for FSTAB is found here. In Dutch is is here.

      In my /etc/fstab I entered this line (in one line):

      //192.168.2.11/public /media/netwerkdrive cifs nounix,uid=1000,iocharset=utf8,codepage=850 0 0

      (Read more about fstab here)

      Where 192.168.2.11 is the static IP adress the drive had in my network. /public is the map on the drive that is given public.

      /media/netwerkdrive is the created directory in my media map where I want to mount the networkdrive.

      cifs is the modern version of samba

      nounix is essential. Else I got "error 20 no such directory".

      uid=1000 prevents getting errors with permissions

      the rest is for proper chars in filenames.

      Then in a console I entered:

      sudo apt-get install smbfs

      To install the filesystem and then I entered:

      sudo md /media/netwerkdrive/
      sudo mount -a

      To create a mountpoint and mount all new networked drives. If you use network manager, and are getting really slow shutdowns. It's probably because the network manager shuts down before unmounting the network shares. That will cause CIFS to hang, and wait for 60 seconds or so. Here's what you do to fix it (again in the console):

      sudo ln -s /etc/init.d/umountnfs.sh /etc/rc0.d/K14umountnfs.sh
      sudo ln -s /etc/init.d/umountnfs.sh /etc/rc6.d/K14umountnfs.sh

      If you want to use FTP instead read this

      --------------------------------------------------------------

      Read more here and here

      And on the ubuntu site read this and this and finally this forum

      And the resolved issue here

      Disable autocheck at mount

      Disable auto fsck check on boot (after 30 mounts):

      In a terminal:

      gksu/ gedit /etc/fstab

      change the 2 into 0 at the end of the entries that you don't want to be autochecked.


      # /etc/fstab: static file system information.
      #
      #              
      proc            /proc           proc    defaults        0       0
      /dev/sda7       /               ext3    defaults,errors=remount-ro 0       1
      /dev/sda10              /home                   ext3    defaults,usrquota,grpquota      0       2
      /dev/sda9       /tmp            ext3    defaults        0       2
      /dev/sda5       none            swap    sw              0       0
      /dev/hda        /media/cdrom0   iso9660 ro,user,noauto  0       0

      Change the ending 2 to 0 on all disks that you want to remove from the auto check.

      # /etc/fstab: static file system information.
      #
      #              
      proc            /proc           proc    defaults        0       0
      /dev/sda7       /               ext3    defaults,errors=remount-ro 0       1
      /dev/sda10              /home                   ext3    defaults,usrquota,grpquota      0       0
      /dev/sda9       /tmp            ext3    defaults        0       0
      /dev/sda5       none            swap    sw              0       0
      /dev/hda        /media/cdrom0   iso9660 ro,user,noauto  0       0

      Storage device manager and mountmanager

      Read all about that here. take care, these tools are not up to date anymore. Make a proper backup of fstab BEFORE you try these programs.

      http://ubuntuforums.org/showthread.php?t=872197
      some interesting forums about this topic are found here:
      community/Fstab
      community/UsingUUID
      community/LinuxFilesystemsExplained
      community/RenameUSBDrive
      community/MoveMountpointHowto
      community/MountingWindowsPartitions
      community/MountingWindowsPartitions/ThirdPartyNTFS3G
      Comments