hddThe /etc/fstab file controls all the automatic mounting for debian-based systems.  I have recently added some external hard drives formated for FAT32.  FAT32 has an inherent flaw with files over 4GB and normally NTFS would be preferred, but these particualr drives are to be used in a mixed linux/mac/windows environment.  Given this standard and the fact that nothing will be bigger than 4GB, I decided to go with FAT32 and automount them.

It takes some effort to piece together mouting options from all the options on the internets.  /etc/fstab can be as complicated as you want and FAT32 seems to complicate things a bit.  Generally, one sees:

[Device] [Mount Point] [File_system] [Options] [dump] [fsck order]
/dev/hdX# / ext3 defaults 0 0

Column 1

Location of device to mount.  X being the hard disk, and # being the partition.  It does not necessarily need to be  local device like a hard drive or cdrom.  You can for instance mount things on other systems not located in /dev.

Column 2

Location to mount files.

Column 3

Options.  Defaults gives you rw, dev, suid, exec, auto, nouser, async (all explained below)

Column 4

Used by the dump utility to backup the system.

Column 5

Used to check filesystems when the system boots. The root filesystem should have a 1, filesystems which don’t need to be checked should have a 0, and all other filesystems should have a 2.


rw, ro

Mount as Read-write or Read-only

auto, no auto

Automatically mount when a system boots.  Alternatively the super user can use mount -a which mounts all device set to auto.

dev, nodev

Use device files on the system.  dev is usually fine, but nodev could be used to mount other filesystems onto your own system like mounting root filesystems without the worry about whatever was inside /dev.

user, nouser

Allow users to mount the filesystem.  nouser basically means only root can mount the filesystem.  Things like floppy drives and cdrom drives would use user so other users can mount them.

exec, noexec

Allow files to be executed on the filesystem.  Usually not needed.

suid, nosuid

Set User ID on execution.  This is a bit which either allows or denies users the ability to execute things with elevated priveleges.  Usually not needed.

async, sync

Write asynchronously or synchronous.  For most devices this is asychronously or just writing things and allowing the system to use buffers to complete the process.

FAT32 by default has not user or file permissions, so I needed to find a way to automount the drive and still give corret access and permissions.  After some trial and error, I came up with:

# USB hard drive automount
LABEL=DRIVENAME /mnt/samba vfat rw, user, auto,uid=1000,gid=1000,umask=022 0 0

Here I used LABEL instead of the device name in /dev or the UUID.  DRIVENAME is the name of the hard drive as seen by windows and mac devices.  uid and gid mounts the system as a particualr user (instead of root).  Just type ‘id’ to see what number you are.  umask sets the read, write, and execute bits for all other users, groups, and world which is 777 – XXX so here it is 755 or 777 – 22.  There is an excellent page on wikipedia with more info.

user and nouser
Permit or forbid ordinary users to mount the filesystem. nouser means that only root can mount the filesystem. This is the normal arrangement. You might use the user option to access the floppy drive without having to be root.

exec and noexec
Allow or do not allow the execution of files on this filesystem. Probably you won’t need these options.

suid and nosuid
Allow or do not allow the suid bit to take effect. Probably you won’t need these options.

Tags: , , , , ,

Comments are closed.



  • slide
  • slide
  • slide
  • slide