[ Pobierz całość w formacie PDF ]
.What is important tounderstand here is that you should know where you are as you navigate the file system.Whenyou install software, especially without the benefit of using Red Hat s rpm package-management command (which you ll learn about in Hour 22, Red Hat Tools ), you shouldknow where different software should reside on your system.Many programs will also requiredifferent software components to be installed in different parts of the directory.If you look at the file system listing, you ll see a /mnt, or mount, directory.Although you don thave to use this directory as a gateway to other filesystems, this is traditionally where othersystems are mounted.The next section discusses how to have these other systems appearunder the mount directory.Using the mount Command to AccessOther FilesystemsThemount command, found under the /bin directory, is an essential program used not onlyby sysadmins, but also by Linux during startup and shutdown.This command is used to2 1mount filesystems and make them available in the directory tree.During startup, the primaryLinux partition, an ext2 filesystem, is mounted at the root filesystem, or /, directory.316 Hour 21You can also have other filesystems automatically mounted when Linux starts, or you mountand unmount filesystems, using the mount and the umount commands, while you work.TheLinux mount command recognizes and will mount (depending on how your kernel isconfigured) more than a dozen different filesystems.This section concentrates on the mostcommon, such as ext2 for Linux, msdos for DOS or Windows, and iso9660 for CD-ROMs.Understanding the Filesystem Table,/etc/fstabWhen you start Linux, one of the first scripts to run is the rc.sysinit script under the /etc/rc.d directory.This script mounts your Linux partition as read-write after it checks thepartition for errors.Then, if everything is OK, it will mount all filesystems described in thefilesystem table, fstab, under the /etc directory with the following command:# mount -a -t nonfsThis mounts all filesystems described in the /etc/fstab (except for NFS filesystems; see themount command manual page for details).The /etc/fstab file is a short text file:#/dev/hda3 / ext2 defaults,usrquota 1 1/dev/hdb /mnt/cdrom ignore 0 0 0/dev/cdrom /mnt/cdrom iso9660 noauto,ro 0 0/dev/hda1 /mnt/dos msdos defaults 0 0/dev/hdc1 /mnt/flash msdos defaults 0 0/dev/fd0 /mnt/floppy ext2 noauto 0 0none /proc proc defaults/dev/hda2 none swap swThe fstab columns show the device, where the filesystem will be mounted, the type offilesystem, any mount options, whether or not the dump command (discussed in Hour 23, Archiving ) needs to check for files to be archived, and the order in which the filesystem ischecked during reboot.The fstab rows show a Linux ext2 filesystem, which you configured to support quotas in thelast hour; two CD-ROM devices (/dev/cdrom is a symbolic link to /dev/hdb); a DOSfilesystem partition on the same hard drive as the Linux ext2 partition; a DOS filesystem ona flash RAM card; the floppy drive; the /proc directory (used internally by the Linux kernel);and finally, the Linux swap filesystem.2 1Handling Files 317You should know that editing the filesystem table by hand is inherentlydangerous.You learned to add quotas in Hour 20, Basic SystemAdministration, but generally you should not edit this file by hand.CAUTIONInstead, use Red Hat s graphical filesystem configuration tool, fstool,discussed in Hour 22.Use this tool if you need to add a hard drive, newpartitions, and so on.Although you can edit the fstab file, before you do,make sure you have a backup boot disk on hand, and make a copy of thefstab file before you edit it.Normally the root operator mounts and unmounts filesystems.But if you take my advice anddon t run Linux as root all the time, you ll have to use the su command to mount andunmount filesystems
[ Pobierz całość w formacie PDF ]