41
Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Embed Size (px)

Citation preview

Page 1: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Linux+ Guide to Linux Certification

Chapter Six

Linux Filesystem Administration

Page 2: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

ObjectivesObjectives

• Identify the structure and types of device files in the /dev directory

• Understand common filesystem types and their features

• Mount and unmount floppy disks to and from the Linux directory tree

• Mount and unmount CD-ROMs to and from the Linux directory tree

Page 3: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

ObjectivesObjectives

• Create hard disk partitions

• Mount and unmount hard disk partitions to and from the Linux directory tree

• Monitor free space on mounted filesystems

• Check filesystems for errors

• Use hard disk quotas to limit user space usage

Page 4: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

The /dev DirectoryThe /dev Directory

• Device file– File used by Linux commands that represent a

specific device on the system– These files are typically found in the /dev

directory

• Character devices– Transfer data to and from the system one data bit

at a time

Page 5: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

The /dev DirectoryThe /dev Directory

• Block devices– Storage devices that transfer to and from the

system in chunks of many bits by caching the information in RAM

– Are represented by block device files– Can transfer information must faster than

character devices

Page 6: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

The /dev DirectoryThe /dev Directory

Table 6-1: Common device files

Page 7: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

The /dev DirectoryThe /dev Directory

Table 6-1 (continued): Common device files

Page 8: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

The /dev DirectoryThe /dev Directory

• Major number– Used by the kernel to identify what device driver

to call to interact properly with a given category of hardware

• Minor number– Used by the kernel to identify which specific

hardware device, within a given category, to use a driver to communicate with

Page 9: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

FilesystemsFilesystems

• Filesystem– The organization imposed on a physical storage

medium that is used to manage the storage and retrieval of data

• Formatting– The process where a filesystem is placed on a

disk drive

Page 10: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Filesystem TypesFilesystem Types

Table 6-2: Common Linux filesystems

Page 11: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Filesystem TypesFilesystem Types

Table 6-2 (continued): Common Linux filesystems

Page 12: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

MountingMounting

• Mounting– Process used to associate a device with a directory in

the logical directory tree such that users may store data on that device

– Term originated in the 1960s, when information was stored on large tape reels that had to be mounted on computers to make the data available

• Mount point– Directory in a file structure to which something is

mounted

Page 13: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

MountingMounting

Figure 6-1: The directory structure prior to mounting

Page 14: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

MountingMounting

Figure 6-2: The directory structure after mounting a floppy device

Page 15: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

MountingMounting

• When the Linux filesystem is first turned on, a filesystem present on the hard drive is mounted to the / directory

• Root filesystem– Filesystem that contains the most files that up the

operating system– Should have enough free space to prevent errors

and slow performance

Page 16: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Working with Floppy DisksWorking with Floppy Disks

• When transferring small amounts of information from computer to computer, it is commonplace to use floppy disk removable media to store the files– However, floppy disks must be prepared before

they are used in Linux

• Recall that each disk device must be formatted with a filesystem prior to being used to store files

Page 17: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Working with Floppy DisksWorking with Floppy Disks

Table 6-3: Commands used to create filesystems

Page 18: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Working with Floppy DisksWorking with Floppy Disks

Table 6-4:Commands useful when mounting and unmounting filesystems

Page 19: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Working with Floppy DisksWorking with Floppy Disks

Figure 6-3: Mounting a floppy device using a GUI environment

Page 20: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Working with Floppy DisksWorking with Floppy Disks

Figure 6-4: Viewing the contents of a floppy device in a GUI environment

Page 21: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Working with Floppy DisksWorking with Floppy Disks

Figure 6-5: Unmounting a floppy device in a GUI environment

Page 22: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Working with CD-ROMsWorking with CD-ROMs

• Linux systems have an ATAPI compliant IDE CD-ROM drive that attaches to the mainboard via an IDE ribbon cable– These CD-ROMs act as a normal IDE hard disk, and

must be configured on of the four configurations below, as seen with their associated device files:

• Primary master (/dev/hda)

• Primary slave (/dev/hdb)

• Secondary master (/dev/hdc)

• Secondary slave (/dev/hdd)

Page 23: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Working with Floppy DisksWorking with Floppy Disks

Figure 6-6: Viewing the contents of a CD-ROM in a GUI environment

Page 24: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Working with Floppy DisksWorking with Floppy Disks

Figure 6-7: Unmounting a CD-ROM device in a GUI environment

Page 25: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Working with Hard DisksWorking with Hard Disks

• IDE hard disk drives attach to the mainboard with an IDE cable and must be configured on one of four configurations, each of which has a different device file:– Primary master (/dev/hda)– Primary slave (/dev/hdb)– Secondary master (/dev/hdc)– Secondary slave (/dev/hdd)

Page 26: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Working with Hard DisksWorking with Hard Disks

• SCSI hard disks are well-suited to Linux servers that require a great deal of storage space for programs and user files

• Different device files associated with SCSI hard disks:– First SCSI hard disk drive (/dev/sda)– Second SCSI hard disk drive (/dev/sdb)– Third SCSI hard disk drive (/dev/sdc)

Page 27: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Working with Hard DisksWorking with Hard Disks

• Different device files associated with SCSI hard disks (continued):– Fourth SCSI hard disk drive (/dev/sdd)– Fifth SCSI hard disk drive (/dev/sde)– Sixth SCSI hard disk drive (/dev/sdf)– And so on

Page 28: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Hard Disk PartitioningHard Disk Partitioning

• Recall that hard disks have the largest storage capacity of any device used to store information on a regular basis– This poses some problems, because as the size of

a disk increases, organization becomes more difficult and the chance of error increases

• Partition– A physical division of a hard disk drive

Page 29: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Hard Disk PartitioningHard Disk Partitioning

• It is good practice to use more than just two partitions on Linux system as this division can be useful to:– Segregate different types of data– Allow for the use of more than one type of filesystem

on one hard disk drive– Reduce the chance the filesystem corruption will

render a system unusable– Speed up access to stored data by keeping filesystems

as small as possible

Page 30: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Hard Disk PartitioningHard Disk Partitioning

• Tracks– Area on a hard disk that form a concentric circle

of sectors

• Sector– Smallest unit of data storage on a hard disk

• Block– Unit of data commonly used by filesystem

commands

Page 31: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Hard Disk PartitioningHard Disk Partitioning

• Cylinder– Series of tracks

on a hard disk that are written to simultaneously by the magnetic heads in a hard disk drive

Figure 6-8: The physical areas of a hard disk

Page 32: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Hard Disk PartitioningHard Disk Partitioning

Table 6-5:Common hard disk partition device files for /dev/had and /dev/sda

Page 33: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Hard Disk PartitioningHard Disk Partitioning

Figure 6-9: A sample Linux partitioning strategy

Page 34: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Hard Disk PartitioningHard Disk Partitioning

Figure 6-10: A sample dual-boot Linux partitioning strategy

Page 35: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Working with Hard Disk PartitionsWorking with Hard Disk Partitions

• Disk Druid is an easy-to-use partitioning tool used with Red Hat Linux, specifically designed for installation only

• To create partitions after installations, you use the fdisk command

• To use the fdisk command, you simply specify the hard disk partition as an argument

Page 36: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Disk UsageDisk Usage

• There may be several filesystems mounted to the directory tree

• The more filesystems that are used, the less likely it is that a corrupted filesystem may interfere with normal system operations

• Conversely, using more filesystems typically results in less hard disk space per filesystem and may result in system errors if certain filesystems fill up with data

• The easiest method for monitoring free space by mounted filesystem is to use the df (disk free space) command

Page 37: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Checking Filesystems for ErrorsChecking Filesystems for Errors

• Filesystem corruption– Errors in a filesystem structure that prevent the

retrieval of stored data

• Syncing– Process of writing data to the hard disk drive that

was stored in RAM

• Bad blocks– Those areas of a storage medium used by

filesystem commands

Page 38: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Checking Filesystems for ErrorsChecking Filesystems for Errors

Table 6-6: Common options to the fsck command

Page 39: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Hard Disk QuotasHard Disk Quotas

• Soft limits– Limit imposed that can be exceeded for a certain

period of time

• Hard limit– Limit imposed that cannot be exceeded

Page 40: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Chapter SummaryChapter Summary

• Disk devices are represented by device files that reside in the /dev directory

• Each disk drive must contain a filesystem, which is then mounted to the Linux directory tree for usage using the mount command

• Hard disks must be partitioned into distinct sections before filesystems are created on those partitions

Page 41: Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration

Chapter SummaryChapter Summary

• There are many different filesystems available to Linux

• It is important to monitor disk usage using the df, du, and dumpe2fs commands to avoid running out of storage space

• If hard disk space is limited, you can use hard disk quotas to limit the space that each user has on filesystems