- •About the Author
- •Credits
- •How This Book Is Organized
- •Part I: Linux Basics
- •Part II: Installation
- •Part III: Configuration
- •Part IV: Administration
- •Part V: Maintaining the Linux System
- •How Each Chapter Is Structured
- •How to Use This Book
- •Conventions Used in This Book
- •What is Linux?
- •The origin of UNIX
- •Who started Linux?
- •Understanding Open Source
- •Understanding Closed Source
- •Understanding Artistic License
- •Is Freeware really free?
- •Is Shareware never free?
- •A comparison and contrast of licensing methods
- •The Growth of Linux
- •Linux on a Personal Computer
- •Graphical installation
- •Hardware detection
- •Graphical user interface
- •Linux limitations on the PC
- •Linux succeeds on the PC
- •Linux on workstations
- •Linux on servers
- •Summary
- •Assessment Questions
- •Scenarios
- •Answers to Chapter Questions
- •Assessment Questions
- •Scenarios
- •Linux Kernel
- •Kernel versions
- •Kernel availability
- •Linux Distributions
- •Beehive
- •BlueCat
- •Caldera OpenLinux
- •Debian
- •Corel
- •DragonLinux
- •Elfstone
- •Gentoo
- •Hard Hat Linux
- •KRUD
- •LinuxPPC
- •Mandrake
- •Phat Linux
- •Slackware
- •StormLinux
- •SuSE
- •TurboLinux
- •Yellow Dog Linux
- •Mini and Specialty Distributions
- •Astaro
- •KYZO
- •FlightLinux
- •NetMAX
- •Packages and Packaging Solutions
- •Red Hat Package Manager
- •Debian Package Management System
- •Tarball
- •Linux Resources
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Assessment Questions
- •Scenarios
- •Linux In the Real World
- •Word Processing
- •Spreadsheets and databases
- •Web browsing
- •File transfer
- •More, more, and more applications
- •The Server and DNS
- •A Linux Web server
- •Linux e-mail server
- •File servers
- •Proxy, news, and search servers
- •FTP servers
- •Firewalls
- •Determining Linux Roles and Services
- •Comparing Linux with other operating systems
- •Hardware compatibility
- •Summary
- •Assessment Questions
- •Scenarios
- •Answers to Chapter Questions
- •Assessment Questions
- •Scenarios
- •Installing Linux
- •Final Preparations for Installation
- •Verification
- •Package selection
- •Final hardware verification
- •Pre-installation partitioning planning
- •Installing Linux
- •Text or GUI installation
- •Basic setup of Linux
- •Selecting the machine type
- •Partitioning the hard disk drive
- •Installing a boot manager
- •Creating the Boot Diskette
- •Networking
- •Additional installation information
- •Accounts and passwords
- •Additional packages to install
- •GUI installation
- •Obtaining video card information
- •Configuring the X windows system
- •Selecting the windows manager or desktop environment
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Answers to Assessment Questions
- •Scenarios
- •Alternative to the GUI Installation
- •Command Line installation
- •Install the Linux system
- •Network installations of Linux
- •Review of a Linux Installation
- •Installation media
- •Initial selections
- •Installation type or class
- •Disk partitioning and formatting
- •Installing LILO
- •Network configuration
- •User accounts
- •Authentication methods
- •Package selection and installation
- •A Dual-Boot Installation of Linux
- •Linux with Microsoft Windows
- •Linux with Microsoft Windows NT and 2000
- •Linux and Solaris
- •Linux and other operating systems
- •Installing Additional Software with gzip and tar
- •Installing Additional Software with RPM
- •Removing software with RPM
- •Upgrading software with RPM
- •Query the RPM software
- •Verify the RPM software
- •Verify the package files
- •Upgrading the Kernel
- •Upgrading a Linux Kernel
- •System Log Files
- •The Final Test of the Installation
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •What is the X Window System?
- •The X Window System
- •X Client and Server communications
- •X Window Manager
- •Configuring X Window Systems
- •Custom X Window System Programs
- •Manual Configuration of the X Window System
- •Documentation
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Basic Network Services
- •TCP/IP Protocol Suite
- •Connection protocols needed
- •Other network protocols
- •Configuring Basic Network Services
- •Host name
- •IP addressing
- •DHCP
- •Netmask
- •Hardware resources
- •Routing and gateways
- •PPP, SLIP and PLIP connections
- •Server Tasks with
- •IP aliases for virtual hosts
- •Apache Web Server
- •Samba File Server
- •Home directories
- •Disk shares
- •Configuring Client Services
- •SMB/CIFS
- •NIS client configuration
- •NFS client configuration
- •Configuring Internet Services
- •Web browser
- •POP and SMTP
- •TFTP
- •SNMP
- •Remote Access
- •Rlogin
- •Telnet
- •OpenSSH
- •Documentation
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Adding Hardware
- •Memory
- •Swap
- •Adding a hard drive
- •Video and monitor
- •Printers
- •Configuration files
- •Setting environment variables
- •BASH
- •Documentation
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Basic User and Group Administration
- •What are users and groups?
- •Creating users
- •Change user information
- •Deleting users
- •Creating groups
- •Getting Around Linux
- •Navigating Linux
- •Common file and directory commands
- •Setting File and Directory Permissions
- •Mounting and Managing File Systems
- •Mount
- •Umount
- •Mounted file systems
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Multi-User Environment
- •The creation of Virtual Consoles
- •The Linux Terminal Server Project
- •Configurations for remote systems
- •Monitoring remote connections
- •Common Shell Commands
- •Basic shell scripts
- •Caution using root access
- •Navigating the GUI interface
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Linux Runlevels
- •init
- •Shutting down Linux
- •Managing Linux Services
- •Configuring Linux Printing
- •lpd daemon
- •/etc/printcap
- •Printing management
- •Using the vi Editor
- •vi operation modes
- •Editing text files
- •Using the
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Disk and File System Management
- •Repairing Partitions
- •System Automation and Scheduling
- •cron
- •Core Dumps
- •Analyzing core dumps
- •GNU Debugger
- •Managing Networking Interfaces
- •Installing System Packages and Patches
- •Compressed archive
- •Debian Package Installer
- •Slackware Package Installation
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Linux Processes
- •Core services versus non-critical services
- •Process administration
- •Process control
- •Monitoring Log Files
- •Maintaining Documentation
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Linux Security
- •Securing the Environment
- •Location
- •Environment
- •System Security
- •System/user files
- •Permissions
- •Log auditing
- •Backups
- •Linux Security Best Practices
- •Network security
- •Firewall
- •System security
- •Securing a Web server
- •Securing an FTP server
- •FTP program version
- •FTP configuration files
- •Process security
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Disaster Recovery Planning
- •Types of data
- •Frequency and Scheduling
- •Storage and media types
- •Recovering data
- •Offsite storage
- •Linux Backup Tools and Commands
- •Third party tools
- •Tape devices
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Identifying the Problem
- •Methodology and Best Practices
- •Troubleshooting Resources
- •Documentation resources
- •Internet resources
- •System Log Files
- •Tools for Log Files
- •Output to another file
- •Locating files
- •Process Configuration and Management
- •Stopping, Starting, and Restarting Processes
- •Configuration Files
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Examining the Startup Process
- •Boot process steps
- •Analyzing Boot Process Errors
- •Common Boot Problems
- •Using System Status Tools
- •File System Check
- •System Resource Commands
- •Using the System Boot Disk
- •Types of boot disks
- •Creating a boot disk
- •Creating a rescue/utility disk
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Common User Problems
- •Login problems
- •File and directory permissions
- •Printing problems
- •Mail problems
- •Software Package Problems
- •Package dependencies
- •Software and version conflicts
- •Backup and Restore Errors
- •Backup hardware
- •Backup software
- •File restore errors
- •Application Failures
- •Log files
- •Process and daemon errors
- •Web server errors
- •Telnet
- •Mail services
- •Basic Networking Troubleshooting
- •Networking connectivity
- •Network hardware problems
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Mainboard Components
- •BIOS
- •System memory
- •System Resources
- •I/O addresses
- •Direct memory access
- •Laptop Considerations
- •PCMCIA
- •Linux Peripheral Configuration
- •Installing and Configuring SCSI Devices
- •SCSI definitions
- •SCSI technologies
- •SCSI cabling and termination
- •SCSI device configuration
- •Linux SCSI devices
- •ATA/IDE Devices
- •IDE drive configuration
- •Linux ATA/IDE Drive configuration
- •Linux Support for Other Devices
- •IEEE 1394 (Firewire)
- •Summary
- •Assessment Questions
- •Scenarios
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •What’s on the CD-ROM
- •System Requirements
- •Using the CD with Microsoft Windows
- •Using the CD with Linux
- •Microsoft Windows applications
- •Linux applications
- •Troubleshooting
- •Sample Exam
- •Exam Questions
- •Exam Answers
- •Taking a CompTIA Exam
- •How to register for an exam
- •What to expect at the testing center
- •Your exam results
- •If you don’t receive a passing score
- •About the Linux + Exam
- •Preparing for the Linux+ Exam
- •For More Information
- •Preamble
- •No Warranty
- •Glossary
- •Index
Chapter 12 Linux Disk and System Management |
385 |
The daily management activities of a Linux system administrator include many different tasks. From managing and configuring disk drives, to managing net-
works, to scheduling maintenance jobs, many parts of the system must be attended to on a routine basis.
For each of these system management activities, the administrator can use many tools and commands to ease the administration and configuration of various parts of the system.
This chapter deals with such system administration items as disk and file system management, by using the fdisk, mkfs, and fsck commands; system job scheduling, by using at and cron; network management, by using the ifconfig command; finding and analyzing core dumps; and finally, upgrading packages and installing patches.
Disk and File System Management
5.1 Create and manage local storage devices and file systems (e.g., fsck, fdisk, mkfs)
The most common tool for managing your disks and file systems is the fdisk utility. This utility allows you to partition your drives and assign file systems to them.
To use fdisk on your hard drives, specify which hard drive you are using with the following conventions:
The first ATA/IDE hard drive is called hda; the second is called hdb, etc.
The first SCSI drive is called sda; the second is called sdb, etc.
With these hard drives, each partition is also numbered, so the first partition of the first IDE drive is hda1.
To start fdisk on the first ATA/IDE drive, use the following command:
fdisk /dev/hda
To view a list of commands that you can use from the fdisk prompt, type ? (question mark). A display output similar to the following appears:
Command action
a toggle a bootable flag
bedit bsd disklabel
c toggle the dos compatiblity flag
ddelete a partition
l list known partition types
mprint this menu
n add a new partition
386 Part V Maintaining the Linux System
p print the partition table
qquit without saving changes
t change a partition’s system id u change display/entry units
v verify the partition table
wwrite table to disk and exit
xextra functionality (experts only)
In addition, in expert mode (see the “x” command in the preceding example), you can use these advanced commands, but I recommend that you don’t use these commands unless you know what you are doing. For most users, the following basic commands will suffice:
Command action
b move beginning of data in a partition
cchange number of cylinders
d print the raw data in the partition table e list extended partitions
h change number of heads
mprint this menu
p print the partition table q quit without saving changes
rreturn to main menu
s change number of sectors v verify the partition table
wwrite table to disk and exit
I recommend that you begin with the “p” command to print a list of your current partition table. The following is a sample partition table from a Linux system:
Device |
Boot |
Start |
End |
Blocks |
ID |
System |
|
/dev/hda1 |
* |
1 949 |
1912152 |
|
83 |
Linux |
|
/dev/hda2 |
950 |
1015 |
133056 |
5 |
Extended |
||
/dev/hda5 |
950 |
1015 |
133024 |
82 |
Linux Swap |
In the preceding example, you can see that /dev/hda1 is the boot drive and that it contains the main Linux system. The system ID is the type of Linux file system, which, in this case, is the ext2 filesystem — the default for Linux.
The Linux swap file is ID 82, and is installed on the /dev/hda5 partition. The following is a list of other file system numbers:
0 |
Empty |
9 |
AIX bootable |
75 |
PC/IX |
b7 |
BSDI fs |
1 |
DOS 12-bit FAT |
a |
OS/2 Boot Manag 80 |
Old MINIX |
b8 |
BSDI swap |
|
2 |
XENIX root |
40 |
Venix 80286 |
81 |
Linux/MINIX |
c7 |
Syrinx |
3 |
XENIX usr |
51 |
Novell? |
82 |
Linux swap |
db |
CP/M |
4 |
DOS 16-bit <32M 52 |
Microport |
83 |
Linux native |
e1 |
DOS access |
|
5 |
Extended |
63 |
GNU HURD |
93 |
Amoeba |
e3 |
DOS R/O |
6 |
DOS 16-bit >=32 64 |
Novell Netware |
94 |
Amoeba BBT |
f2 |
DOS Sec |
|
7 |
OS/2 HPFS |
65 |
Novell Netware |
a5 |
BSD/386 |
ff |
BBT |
8AIX
Chapter 12 Linux Disk and System Management |
387 |
The most important ID numbers to remember are the Linux specific designations, such as 82 for the Linux Swap file, and 83 for a typical Linux partition.
As the preceding examples demonstrate, you can see and format partitions for all types of systems. If you have a dual-boot system with Microsoft Windows, use the DOS fat file system.
You can use the fdisk tool to add and delete partitions. You must set the size of the partition by number of blocks. You must also set the file system with the file system ID number. After you finish, hit the “w” command to write the partition table to disk, and then exit the utility.
After you have set up your partitions, you won’t be able to use them until you actually format the partitions with a valid file system. For Linux, the default file system is the ext2 system. If you have added another hard drive to your system, such as /dev/hdb, you will want to create another partition for Linux to use on that drive.
Using the fdisk tool, add a partition called /dev/hdb1. If you want, use all the available blocks to allocate the entire drive to one partition. After you finish using fdisk, format the partition with the ext2 file system.
For this, you need to use the mkfs command:
mkfs -t ext2 /dev/hdb2
This command tells the mkfs command to invoke the mke2fs utility to format the partition with the ext2 file system.
To mount the file system for use, use the mount command to mount your new partition:
mount /dev/hdb1 /home2
The file system used by Linux is the ext2 file system.
Repairing Partitions
File systems can be very complex, and with a great amount of disk activity and read and writes, the occasional error is bound to happen. The utility that you use to repair these problems and inconsistencies is fsck, which is short for “File System Check.” (This is similar in function to the Windows SCANDISK utility)
The fsck utility scans all disks and partitions, and if possible, repairs them when necessary. This utility runs automatically at boot time if the system has shut down