-->
Previous | Table of Contents | Next |
In this sample file, you can see several different file systems. First, notice that comments in the file are prefixed by a # character. In this fstab file, two normal Linux file systems are mountedthe disk partitions /dev/hda1 and /dev/hda2. These are listed as being of type ext2 and are mounted under the root directory, /, and /usr respectively.
The entry defaults listed under the options field indicates that this file system should be mounted by using a common set of default options. Specifically, the file system is mounted read/write enabled, its to be interpreted as a block special device, all file I/O should be done asynchronously, the execution of binaries is permitted, the file system can be mounted with the mount -a command, the set UID (user ID) and set GID (group ID) bits on files are interpreted on this file system, and ordinary users arent allowed to mount this file system. As you can see, its a lot easier just to type defaults for the option instead.
See Creating the Swap Partition, p. 72 and p. 99
The partition /dev/hda3 is a swap partition thats used for kernel virtual-memory swap space. Its mount point is specified as none because you dont want it to appear in the file system tree. It still has to be in the /etc/fstab file, so the system knows where its physically located. Swap partitions are also mounted with the option sw.
The /proc file system is a virtual file system that points to the process information space in memory. As you can see, it doesnt have a corresponding physical partition to mount.
TIP: For full information on all options available in the /etc/fstab file, refer to the man page for fstab.
MS-DOS file systems can also be mounted automatically. The partition /dev/sda1 is the first partition on the SCSI hard drive sda. Its mounted as an MS-DOS partition by specifying msdos as the type and by giving /dosc as its mount point. You can place the mount point for the MS-DOS file system anywheretheres no requirement that it be under the root directory.
Now that you know all sorts of stuff about mounting file systems, its time to look at how to unmount. You use the umount command to unmount file systems. You would want to unmount a file system for several reasons: so that you can check/repair a file system with fsck, unmount NFS-mounted file systems in case of network problems, or unmount a file system on a floppy drive.
NOTE: This command is umount, not unmount. Make sure that you type it correctly.
There are three basic forms of the umount command:
umount device | mountpoint umount -a umount -t fstype
device is the name of the physical device to unmount; mountpoint is the mount point directory name (specify only one or the other). The umount command has only two command-line parameters: -a, which unmounts all file systems, and -t fstype, which acts only on file systems of the type specified.
CAUTION:
The umount command doesnt unmount a file system thats in use. For example, if you have some file system mounted under /mnt and you trycd /mntumount /mntyou get an error telling you that the file system is busy. You have to change to a different directory in another file system to unmount the file system mounted under /mnt.
The Network File System (NFS) is a system that allows you to mount file systems from a different computer over a TCP/IP network. NFS allows you to share data among PC, Mac, UNIX, and Linux systems. Under NFS, a file system on a remote computer is mounted locally and looks just like a local file system to users. The illusion of being mounted locally has numerous uses. For example, you can have one machine on your network with a lot of disk space acting as a file server. This computer has all the home directories of all your users on its local disks. By mounting these disks via NFS on all your other computers, your users can access their home directories from any computer.
NFS has three essential components:
The following sections discuss exporting the file system and mounting it locally.
For clients to mount an NFS file system, this file system must be made available by the server. Before the file system can be made available, you must ensure that its mounted on the server. If the file system is always going to an NFS exported file system, you should make sure that you have it listed in the /etc/fstab file on the server so that it automatically mounts when the server boots.
When you have the file system mounted locally, you can make it available via NFS. This is a two-step process. First, you must make sure that the NFS daemons rpc.mountd and rpc.nfsd are running on your server. These daemons are usually started from the startup /etc/rc.d/init.d/nfs script. Usually, all thats needed is to make sure that the following lines are in your script:
daemon rpc.mountd daemon rpc.nfsd
NOTE: As RPC-based programs, the rpc.mountd and rpc.nfsd daemons arent managed by the inetd daemon but are started up at boot time, registering themselves with the portmap daemon. You must be sure to start them only after rpc.portmap is running.
Second, you must enter the NFS file system in a configuration file named /etc/exports. This file contains information about what file systems can be exported, what computers are allowed to access them, and what type and level of access is permitted.
Previous | Table of Contents | Next |