Mounting II
Summary:- Uses Of 'fstab'
- 'fstab' Entries explained
- Using 'supermount'
Uses Of 'fstab'
The central configuration file for the 'mount' command is '/etc/fstab'. You can either use 'diskdrake' (Mandrake Control Center - Hardware - Mount Points) to make changes to that file, or edit the file directly as 'root'. '/etc/fstab' has several uses:- You can determine which media to mount automatically on boot.
- You can specify fixed mount options and mount points for every medium.
- The system uses it to mount several 'virtual' file systems.
Mounting Media On Boot
By default, all media listed in 'fstab' are mounted on boot. If a medium isn't available, 'mount' will print an error message and continue with the next entry. Notice that this also applies to networked media like NFS or SMB shares. To prevent 'mount' from trying to mount a medium on boot time, you have to supply the 'noauto' option to the entry of that medium in '/etc/fstab'.Specifying Mount Options And Mount Points
If you've read the previous page, you already know that the 'mount' command has two sets of options: a set of general options and a set specific to each file system. File system specific options are file system specific. Really ;-) If you supply an entry in 'fstab' with an option which is specific to a file system (for exampleumask=0
Virtual File Systems
Depending on system configuration, 'fstab' contains a number of entries for 'virtual file systems'. These entries do not have corresponding device files listed. Whatever you do, don't mess with these entries1.1- 'proc' mounts the 'process tree' under '/proc' which provides a slew of information on what's going on on your system.
- 'pts' enables 'pseudo terminal support', a Unix compatibility feature.
- 'shm' enables support for 'POSIX shared memory'. Only used by a few programs, but doesn't hurt.
fstab Entries Explained 1.1 Local Fixed System Partitions
You see that there are already entries in '/etc/fstab' for your system partitions like '/'. Have a look at one of them:/dev/hda3 / ext2 defaults 1 1
defaults
rw
suid
exec
auto
nouser
async
The 'dump' field is either set to '1' (enable) or '0' (disable). Since 'dump' is used by backup programs for the ext2 / ext3 file system only, '1' is set just with entries for ext2 / ext3 media. All other media use '0'.
The 'fsck' field can either be set to '0' (disable file system check), '1' (check first) or '2' (check). '0' is set for all media with non-Linux file systems, removable and networked media, and virtual file systems. '1' is set for the '/' entry, since this partition has to be mounted (and thus checked) first and '2' for all other non-removable, local media with Linux file systems.
Removable Media
Removable data storage like CDs needs different options (if you are not using 'supermount'):/dev/cdrom /mnt/cdrom auto user,noauto,exec,ro 0 0
user
exec
exec
user
noauto
ro
mount /mnt/cdrom
A mounted CD will lock the CD tray. To change or eject the CD, you have to unmount it first with
umount /mnt/cdrom
Local Fixed Non-System Partitions
Now what would an entry for an MS-Windows partition look like? Assume it is the second partition on your first IDE drive and you want to have it mounted automatically. It's/dev/hda2 /mnt/win_d vfat umask=0,quiet 0 0
codepage=850
NFS and SMB shares can also be configured via 'fstab'. Please read the articles on Samba and NFS first, since options here are important and require some understanding on how these protocols work. The basic syntax is not very different from that for local media. The entry for the 'device file' is just replaced by an entry for the remote server and share:
remote_server:share local_mount_point file_system options dump fsck
domain.com:/share/nfs /mnt/nfs nfs rw 0 0
Using 'supermount'
If you are using 8.1, read this hint on 'supermount'. 'supermount' has been introduced in Mandrake Linux to make the handling of removable media much easier. It uses a nifty trick to automatically mount all inserted media: it mounts the (empty) devices by itself on boot and queries them regularly for newly inserted or removed media. The effect of which is that you don't have to mount or unmount external devices anymore: the system does it all by itself. There just four instances left you have to worry about mounting: when adding a new device you want 'supermount' to handle, when you have to use a medium unmounted, when you use media with different file systems in the same device, or when you want to pass options to the 'mount' command via a 'supermount' entry.Extending 'supermount' to new devices
~# supermount -i enable enables 'supermount' on all removable devices listed in '/etc/fstab'. In order to have this take effect, you have to reboot. This command requires 'root' privileges. If the system doesn't recognize your new external device and thus doesn't write an entry to '/etc/fstab', you'll have to do that by yourself, either by creating a standard fstab entry for that device and then running the 'supermount' command to enable it, or by writing an entry in the 'supermount' format right away. A common 'supermount' entry for a CD drive looks like this:/mnt/cdrom /mnt/cdrom supermount fs=iso9660,dev=/dev/cdrom 0 0 mount_point mount_point supermount fs=file_system,dev=device 0 0
Unmounted Media In 'supermount' Devices
Certain tasks like playing music CDs for example require the medium to be inserted but unmounted. There's currently no other solution then to unmount the device, thus making it possible to use the unmounted medium but also turning off 'supermount' for the remaining session.Using 'supermount' with different file systems
That entry in '/etc/fstab' however will only work with media that are formatted with the MS-Windows file system (vfat). It will not mount media formatted with GNU/Linux' extfs2, for example. You can change this easily, though, by simply setting the entry for the file system type to 'auto'. Make sure that '/etc/filesystems' contains entries for all the file systems you use. 'supermount' will now look up this file when inserting a medium and mount it with the appropriate parameters.Passing 'mount' options to 'supermount' in '/etc/fstab'
If you need or want to pass options to the 'mount' command when the device is handled by 'supermount', you will need to separate these options from those passed to 'supermount' itself with\-\-,
/mnt/zip /mnt/zip supermount fs=vfat,dev=/dev/sda4,\-\-,umask=0 0 0
Related Resources:
man mountman fstab
man supermount Revision / Modified: Jan 09, 2002
Author: Tom Berger Legal: This page is covered by the GNU Free Documentation License. Standard disclaimers of warranty apply. Copyright LSTB and Mandrakesoft.
Mounting II
Version 1.10 last modified by ptyxs on 18/01/2007 at 16:22
Version 1.10 last modified by ptyxs on 18/01/2007 at 16:22
Document data
- Lost account?
- Join the community, be part of the Club: it's free!
- Get the PWP Download Subscription!
Mandriva.com
Store
Club



Comments (1)