Day 4 Summary
This summary covers the fourth day's topics, focusing on advanced storage with LVM, filesystem management, system logging, and file archiving techniques.
Session 11: LOGICAL VOLUMES
This session introduces Logical Volume Management (LVM), a flexible and powerful method for managing disk storage that provides an abstraction layer between physical disks and filesystems.
LVM Core Components
- Physical Volumes (PV): Physical storage devices (like partitions or whole disks) that are initialized to be used by LVM.
- Volume Groups (VG): A storage pool created by combining one or more Physical Volumes. This is the central unit of storage in LVM.
- Logical Volumes (LV): "Virtual" partitions created from the storage pool in a Volume Group. Filesystems are created on Logical Volumes, and they can be resized easily.
Viewing LVM Components
| Command | Description |
|---|---|
pvs / pvdisplay | Displays information about Physical Volumes. |
vgs / vgdisplay | Displays information about Volume Groups. |
lvs / lvdisplay | Displays information about Logical Volumes. |
GNOME Disk Utility
RHEL provides a graphical tool (gnome-disk-utility) for viewing and managing disks, partitions, and LVM components, offering a user-friendly alternative to the command line.
Session 12: MANAGE FILESYSTEM ATTRIBUTES
This session covers the practical aspects of managing filesystems, including mounting them to make them accessible, configuring them to mount at boot, and performing maintenance.
Mounting and `/etc/fstab`
Filesystems are attached to the directory tree using the mount command. The /etc/fstab file is a critical configuration file that defines which filesystems are mounted automatically at boot time. Using persistent labels (LABEL=...) or UUIDs in fstab is recommended over device names like /dev/sdb1.
Filesystem Maintenance
Linux provides tools to check and repair filesystem integrity. These tools should only be run on unmounted filesystems to prevent data corruption.
| Command | Description |
|---|---|
mount /dev/sdb1 /data | Mounts a device to a specified mount point. |
umount /data | Detaches (unmounts) a filesystem. |
fsck /dev/sdb1 | Checks and repairs an EXT-family filesystem (e.g., ext4). |
xfs_repair /dev/sdb1 | Checks and repairs an XFS filesystem. |
Session 13: CONFIGURING LINUX LOGGING
This session details how to configure, manage, and analyze system logs using both the traditional rsyslog service and the modern systemd-journald.
System Logging with `rsyslog` and `journald`
- rsyslog: The standard logging daemon. It collects messages based on rules in
/etc/rsyslog.conf(defined by facility and priority) and directs them to files (like/var/log/messages) or remote servers. - systemd-journald: A centralized logging service that captures logs from the kernel, services, and other sources in a structured, indexed binary format. Logs are viewed with the
journalctlcommand.
Key Logging Commands
| Command | Description |
|---|---|
journalctl | Views the entire system journal. |
journalctl -u httpd | Shows logs only for the specified service (e.g., httpd). |
journalctl -f | Follows the journal in real-time (similar to tail -f). |
logger "Test message" | Sends a custom message to the logging system for testing. |
Log Rotation
The logrotate utility automatically manages log files to prevent them from using too much disk space. It rotates, compresses, and deletes logs based on rules in /etc/logrotate.conf and files in /etc/logrotate.d/.
Session 14: ARCHIVING FILES AND REMOTE COPYING
This session focuses on essential tools for bundling, compressing, and transferring files, which are common tasks in system administration.
Archiving and Compression
The tar (tape archive) utility is used to bundle multiple files into a single archive. This archive can then be compressed to save space using tools like gzip or bzip2.
| Command | Description |
|---|---|
tar -czvf archive.tar.gz /path/to/dir | Creates a gzipped tar archive. |
tar -xzvf archive.tar.gz | Extracts a gzipped tar archive. |
tar -tvf archive.tar.gz | Lists the contents of an archive without extracting. |
Remote File Transfer
Secure tools are available for copying files between systems over the network.
- scp (Secure Copy): Simple command for securely copying files over SSH.
- sftp (Secure FTP): Provides an interactive, FTP-like session over SSH for uploading and downloading files.
- rsync (Remote Sync): An efficient utility for synchronizing files and directories. It is very fast for subsequent transfers as it only copies the differences.