- Table of Contents
- Copyright
- About the Lead Authors
- About the Contributing Authors
- Acknowledgments
- Tell Us What You Think!
- Introduction
- I. Red Hat Linux Installation and User Services
- Chapter 1. Introduction to Red Hat Linux
- Chapter 2. Installation of Your Red Hat System
- Chapter 3. LILO and Other Boot Managers
- Chapter 4. Configuring the X Window System, Version 11
- Chapter 5. Window Managers
- Chapter 6. Connecting to the Internet
- Chapter 7. IRC, ICQ, and Chat Clients
- Chapter 8. Using Multimedia and Graphics Clients
- II. Configuring Services
- Chapter 9. System Startup and Shutdown
- Chapter 10. SMTP and Protocols
- Chapter 11. FTP
- Chapter 12. Apache Server
- Chapter 13. Internet News
- Chapter 14. Domain Name Service and Dynamic Host Configuration Protocol
- Chapter 15. NIS: Network Information Service
- Chapter 16. NFS: Network Filesystem
- Chapter 17. Samba
- III. System Administration and Management
- Chapter 18. Linux Filesystems, Disks, and Other Devices
- Chapter 19. Printing with Linux
- Chapter 20. TCP/IP Network Management
- Chapter 21. Linux System Administration
- Chapter 22. Backup and Restore
- Chapter 23. System Security
- IV. Red Hat Development and Productivity
- Chapter 24. Linux C/C++ Programming Tools
- Chapter 25. Shell Scripting
- Chapter 26. Automating Tasks
- Chapter 27. Configuring and Building Kernels
- Chapter 28. Emulators, Tools, and Window Clients
- V. Appendixes
- A. The Linux Documentation Project
- B. Top Linux Commands and Utilities
- C. The GNU General Public License
- D. Red Hat Linux RPM Package Listings
Setting Up Filesystems
There are several ways of changing the entries in the /etc/fstab file. The first is to edit the file manually using your favorite editor. This assumes that you are a flawless typist and know all of the different options. Of course, knowing how to edit the file by hand means you do not have to have the X Window System running. I will also discuss how to administer filesystems with the fsconf utility (/sbin/fsconf) and linuxconf (/sbin/linuxconf). These utilities can be run in several ways; they both have a GUI interface, a text mode, and a curses-based interface.
Editing /etc/fstab Manually
The filesystem table /etc/fstab is just a text file; it is designed to have a specific format that is readable by humans and not just computers. It is separated into columns by tabs or spaces. You can edit it with your favorite text editor; it doesn't matter which. You must take care, however, if you modify it by hand because removing or corrupting an entry will make the system unable to mount that filesystem the next time it boots. For this reason, I make a point of saving previous versions of this file using the Revision Control System (a very useful program; see the manual page for rcs).
A sample /etc/fstab looks like this:
# # /etc/fstab # # You should be using fstool (control-panel) to edit this! # #<device> <mountpoint> <filesystemtype> <options> <dump> <fsckorder> /dev/hda1 / ext2 defaults 1 1 /dev/hdb5 /home ext2 defaults,rw 1 2 /dev/hda3 /usr ext2 defaults 1 2 /dev/hdb1 /usr/src ext2 defaults 1 3 /dev/hdc /mnt/cdrom iso9660 user,noauto,ro 0 0 /dev/sbpcd0 /mnt/pcd iso9660 user,noauto,ro 0 0 /dev/fd1 /mnt/floppy vfat user,noauto 0 0 /proc /proc proc defaults /dev/hda2 none swap sw
The first four entries are the ext2 filesystems composing the sample Linux system. When Linux is booted, the root filesystem is mounted first; all the other local (that is, non-network) filesystems are mounted next. Filesystems appear in /etc/fstab in the order they are mounted; /usr must appear before /usr/src, for example, because the mount point for one filesystem exists on the other. The following three filesystems are all removable filesystems (two CD-ROMs and a floppy drive). These have the noauto option set so that they are not automatically mounted at boot time. The removable devices have the user option set so that I can mount and unmount them without having to use su all the time. The CD-ROMs have the filesystem type iso9660, which is the standard filesystem for CD-ROMs, and the floppy drive has the filesystem type vfat because I often use it for interchanging data with MS-DOS and Windows systems.
The last two filesystems are special; the first (/proc) is a special filesystem provided by the kernel as a way of providing information about the system to user programs. The information in the /proc filesystem is used to make utilities such as ps, top, xload, free, netstat, and so on work. Some of the "files" in /proc are really enormous (for example, /proc/kcore). Don't worry; no disk space is wasted. All the information in the /proc filesystem is generated on-the-fly by the Linux kernel as you read it. You can tell that they are not real files because, for example, root can't give them away with chown.
The final "filesystem" isn't a filesystem at all; it is an entry that indicates a disk partition used as swap space. Swap partitions are used to implement virtual memory. Files can also be used for swap space. The names of the swap files go in the first column where the device name usually goes.
The two numeric columns on the right relate to the operation of the dump and fsck commands. The dump command compares the number in column 5 (the dump interval) with the number of days since that filesystem was last backed up. This way it can inform the system administrator that the filesystem needs to be backed up. Other backup software—for example, AMANDA—can also use this field for the same purpose. (Refer to Chapter 22 for more information on AMANDA.) Filesystems without a dump interval field are assumed to have a dump interval of 0, denoting "never dump." For more information, see the manual page for dump.
The sixth column is the fsck pass and indicates which filesystems can be checked in parallel at boot time. The root filesystem is always checked first, but after that, separate drives can be checked simultaneously because Linux is a multitasking operating system. There is no point, however, in checking two filesystems on the same hard drive at the same time because this results in a lot of extra disk head movement and wasted time. All the filesystems that have the same pass number are checked in parallel from 1 upward. Filesystems with a 0 or missing pass number (such as the floppy and CD-ROM drives) are not checked at all.
Creating New Filesystems | Next Section

Account Sign In
View your cart