
ISBN: 9781615844302 (Paperback Edition) ASIN: B002UHKXWQ (eBook Edition)
This book covers three main objectives – to provide a resource to individuals, including novice, IT/Non-Red Hat Enterprise Linux (RHEL) administrators and Linux/UNIX administrators who intend to take the new Red Hat Certified Technician (RH202) and/or Red Hat Certified Engineer (RH302) exams and pass them; to provide a quick and valuable on-the-job resource to RHEL administrators, administrators of UNIX and other Linux operating systems, IT managers, programmers and DBAs working in the RHEL environment; and to provide an easy-to-understand guide to novice and IT/non-RHEL administrators who intend to learn RHEL from the beginning. The book has 31 chapters and is structured to facilitate readers to grasp concepts, understand implementation procedures, learn command syntax, configuration files and daemons involved, and comprehend troubleshooting. The chapters are divided into four key areas: Linux Essentials, RHEL System Administration, RHEL Network and Security Administration, and RHEL Troubleshooting. 1. RHEL 5 Essentials (chapters 1 to 7) covers the basics of Linux. Information provided includes general Linux concepts, basic commands, file manipulation and file security techniques, text file editors, shell features, basic shell and awk programming and other essential topics. 2. RHEL 5 System Administration (chapters 8 to 19) covers RHEL-specific system administration concepts and topics including hardware management, local installation, X Window and desktop managers, software and user/group account administration, disk partitioning using standard, RAID and LVM, file system and swap management, system shutdown and boot procedures, kernel management, backup, restore and compression functions, print services administration, and automation and system logging. 3. RHEL 5 Network and Security Administration (chapters 20 to 30) covers RHEL network and security administration concepts and topics such as OSI and TCP/IP reference models, subnetting and IP aliasing, network interface administration, routing, basic network testing and troubleshooting tools, naming services (DNS, NIS, LDAP) and DHCP; Internet services and electronic mail management, time synchronization with NTP, resource sharing with NFS, AutoFS and Samba, network-based and hands-free automated installation, Apache web server and Squid caching/proxy server, secure shell, PAM, TCP Wrappers, IPTables firewall, NATting, SELinux and common system hardening recommendations. 4. RHEL 5 Troubleshooting (chapter 31) covers a number of sample system, network and security troubleshooting scenarios from an exam perspective. Each chapter in the book begins with a list of major topics covered in the chapter and ends with a summary. Throughout the book, tables, figures, screen shots and examples are furnished for explanation. The book includes several appendices, the first two of which contain sample exercises, and you are expected to perform them using the knowledge and skills gained from reading the book and practicing the procedures. Tables of commands, important files and service daemons follow in subsequent appendices. |


The Red Hat Certified Technician (RHCT) and the Red Hat Certified Engineer (RHCE) certification exams are designed for Linux/UNIX professionals. The official exam objectives are listed at https://www.redhat.com/certification/rhct and https://www.redhat.com/certification/rhce, and are also given below. Visit the URLs for an up-to-date and more in-depth information. The exam objectives are covered in sufficient detail in chapters throughout the book. Common Skills Required for Both Exams:
RHCT Installation and Configuration Skills:
RHCT Troubleshooting and System Maintenance Skills:
RHCE Installation and Configuration Skills:
RHCE Troubleshooting and System Maintenance Skills:
|

Disk Partitioning Using Logical Volume Manager The LVM solution is widely used for managing disk storage. LVM enables you to accumulate spaces taken from one or several disks (called physical volumes) to form a large logical container (called volume group), which can then be divided into partitions (called logical volumes). Figure 13-1 demonstrates LVM components. LVM structure is made up of three key virtual objects called physical volume, volume group and logical volume that use physical extents (PEs) and logical extents (LEs) to further carve up the virtual objects. These components are explained in the following sub-sections. Physical Volume A physical volume (PV) is created when a standard partition, a software RAID partition or an entire disk is brought under LVM control by initializing the partition or disk, and constructing LVM data structures on it. A partition or disk must first be initialized before it can be used in a volume group. Currently, there is one physical volume on the system, which was created during RHEL installation. Run the pvs command to view it: The output indicates that there is one physical volume /dev/sda2 of size 29GB in the VolGroup00 volume group. Volume Group # vgs When a volume group is created, the physical volume added to it is divided into several smaller logical pieces known as physical extents (PEs). An extent is the smallest allocatable unit of space in LVM. At volume group creation time, you can either define the size of the PE or leave it to the default value, which is 4MB. This means an 8GB disk would contain approximately 2000 PEs. All physical volumes in a volume group must use the same PE size. The following command displays physical extent size used in VolGroup00 volume group: # vgdisplay VolGroup00 Logical Volume A logical volume can be increased or decreased in size and can use space taken from several physical volumes inside the volume group. # ll /dev/VolGroup00 Currently, there are seven logical volumes on the system, which were created during RHEL installation. Run the lvs command to view them: The output indicates that there is one volume group VolGroup00 containing seven logical volumes. Logical Extent The PE and LE sizes are usually kept the same within a volume group. A logical extent, however, can be smaller or larger than a physical extent. The default size for an LE is 4MB. The following command displays information about /dev/VolGroup00/lvol1 logical volume. The output does not indicate the LE size; however, you can divide the LV size by the Current LE count to get the LE size (which comes to 32MB in this example). # lvdisplay /dev/VolGroup00/lvol1 Managing Disk Space Using LVM Initialize /dev/sdb disk: Execute the vgdisplay command to view what vgcreate has done. Run this command with and without the –v option. With –v, it reports in detail. --- Physical volumes --- PV Name /dev/sdc1 At this point, you have a pool of storage space available within VolGroup01 that you can use to construct logical volumes. Create a logical volume of size 2000MB using the lvcreate command: # lvcreate –L 2000 VolGroup01 The size can be specified in KBs (kilobytes), MBs (megabytes), GBs (gigabytes), TBs (terabytes), PBs (petabytes), EBs (exabytes) or LEs (logical extents), however, MB is the default. In the above example, the size specified is 2000MB. Alternatively, you can use the –l option and specify the size in multiples of LEs. For example, to create another logical volume of size 2000MB (which is equal to 500 LEs), run the above command as follows: # lvcreate –l 500 VolGroup01 Run the vgdisplay command to see what lvcreate has performed: # vgdisplay –v VolGroup01 --- Logical volume --- --- Logical volume --- --- Physical volumes --- PV Name /dev/sdc1 Notice the change in the vgdisplay output before and after the creation of the logical volumes. The logical volumes constructed above have used the default logical volume names which are lvol0 and lvol1. The following example creates a 3150MB logical volume called oravol in VolGroup01: # lvcreate –L 3150 –n oravol VolGroup01 To display oravol logical volume information, use the lvdisplay command: # lvdisplay /dev/VolGroup01/oravol At this stage, you may want to view the file contents in the /etc/lvm/backup directory where volume group information, along with physical volumes and logical volumes, is stored. Each volume group in the system has a sub-directory corresponding to its name. # ll /etc/lvm/backup The contents of VolGroup01 file is displayed below: # cat /etc/lvm/backup/VolGroup01 creation_host = "rhel01" # Linux rhel01 2.6.18-92.el5 #1 SMP Tue Apr 29 13:16:12 EDT 2008 i686 VolGroup01 { physical_volumes { pv0 { status = ["ALLOCATABLE"] lvol0 { You can use the LVM Configurator to create a logical volume. Follow the steps below to create lvol1: Start LVM Configurator and go to Volume Groups VolGroup01 VolGroup01 Logical View. Click Create New Logical Volume. Enter the logical volume name and size, and leave other values to defaults. Click OK. Extending a Volume Group Extending a volume group adds one or more physical volumes to it. Currently, VolGroup01 includes two physical volumes /dev/sdb and /dev/sdc1. The following example adds to it another disk /dev/sdd. # pvcreate /dev/sdd Do a vgdisplay with –v to see updated information about VolGroup01. Start LVM Configurator and go to Volume Groups VolGroup01 VolGroup01 Physical View. Click Extend Volume Group. Highlight the partition or disk that you wish to add to the volume group and click OK. Extending a Logical Volume Extending a logical volume increases the logical volume in size. Currently, three logical volumes – lvol0, lvol1 and oravol – with sizes 2000MB, 2000MB and 3150MB respectively, exist. The following example extends lvol0 to 5000MB. Use the lvextend command to perform this activity. You can specify the size in either MBs or LEs. All of the following will generate an identical result: # lvextend –L 5000 /dev/VolGroup01/lvol0 Alternatively, you can use the lvresize command to extend a logical volume. For example, to double the size of lvol1 to 4000MB, do any of the following: # lvresize –L 4000 /dev/VolGroup01/lvol1 Do a vgdisplay with –v to see updated information about VolGroup01. You can also use the lvdisplay command with –v option on the lvol0 and lvol1 logical volumes to view details. You can use the LVM Configurator to extend a logical volume. Follow the steps below to extend lvol1: Start LVM Configurator and go to Volume Groups VolGroup01 VolGroup01 Logical View lvol1. Click Edit Properties. Specify a new size and click OK. Reducing a Logical Volume Reducing a logical volume decreases the logical volume in size. Currently, lvol0 is 5000MB. The following example reduces it to 1000MB. Use the lvreduce command to perform this activity. You can specify the size in either MBs or LEs. All of the following will do exactly the same: # lvreduce –L 1000 /dev/VolGroup01/lvol0 There is a risk involved when reducing the size of a logical volume, critical data may be lost. Always perform a backup of data in the logical volume before reducing it. See Chapter 17 “Backup, Restore and Compression” for details on how to perform backups. You can use the LVM Configurator to reduce a logical volume. Follow the steps below to reduce lvol1: Start LVM Configurator and go to Volume Groups VolGroup01 VolGroup01 Logical View lvol1. Click Edit Properties. Specify a new size and click OK. Renaming a Logical Volume Renaming a logical volume changes the name of the logical volume. The following example renames lvol0 to newlvol0. Use the lvrename command to perform this activity: # lvrename /dev/VolGroup01/lvol0 /dev/VolGroup01/newlvol0 You can use the LVM Configurator to rename a logical volume. Follow the steps below to rename lvol1: Start LVM Configurator and go to Volume Groups VolGroup01 VolGroup01 Logical View lvol1. Click Edit Properties. Specify a new name and click OK. Removing a Logical Volume Removing a logical volume is a destructive task. Ensure that you perform a backup of any data in the target logical volume prior to deleting it. You will need to unmount the file system or disable swap in the logical volume. See Chapter 14 “File Systems and Swap” on how to unmount a file system and disable swap. Use the lvremove command to remove lvol0: # lvremove /dev/VolGroup01/lvol0 The command gives a warning message. Proceed with caution. You can use the LVM Configurator to remove a logical volume. Follow the steps below to remove lvol1: Start LVM Configurator and go to Volume Groups VolGroup01 VolGroup01 Logical View lvol1. Click Remove Logical Volume and then Yes to remove it. Moving Physical Extents If a physical volume with some PEs being used needs to be removed from a volume group, the data that resides in those PEs will need to be moved out to an available physical volume(s) in the same volume group. The destination physical volume(s) should have at least the same number of unused PEs available. The pvmove command is used for this purpose. The following example moves PEs from /dev/sdc1 to unused PEs available on any other physical volume in the volume group. Specify the name of a destination physical volume if you wish the PEs to be moved there. This operation can safely be performed on an online, busy logical volume. # pvmove /dev/sdc1 Issue vgdisplay and pvdisplay commands to view the updated information. You can use the LVM Configurator to move PEs. Follow the steps below to move /dev/sdc1 PEs: Start LVM Configurator and go to Volume Groups VolGroup01 VolGroup01 Physical View /dev/sdc Partition 1. Highlight extents in the graphics and click Migrate Selected Extent(s) from Volume. Click Yes to confirm the move. Reducing a Volume Group Reducing a volume group removes one or more physical volumes from it. Currently, VolGroup01 includes three physical volumes: /devsdb, /dev/sdc1 and /dev/sdd. Use vgreduce to remove /dev/sdc1 from it. The physical volume must not be in use. # vgreduce VolGroup01 /dev/sdc1 Issue vgdisplay with –v option to see the updated information about VolGroup01. You can use the LVM Configurator to reduce a volume group. Follow the steps below to remove /dev/sdc1 to reduce VolGroup01: Start LVM Configurator and go to Volume Groups VolGroup01 VolGroup01 Physical View /dev/sdc Partition 1. Click Remove Volume from Volume Group and then Yes to remove it. Removing a Volume Group Removing a volume group removes all logical volumes within that volume group and then remove the volume group. Currently, you have lvol1 and oravol logical volumes in VolGroup01. Use the vgremove command with –f (--force) option to remove the logical volumes and then the volume group itself: # vgremove –f VolGroup01 Remember to proceed with caution whenever you perform reduce and remove operations. You can use the LVM Configurator to remove a volume group. Follow the steps below to remove VolGroup01. Start LVM Configurator and go to Volume Groups VolGroup01 VolGroup01 Logical View. Remove both logical volumes. Go to VolGroup01 Physical View VolGroup01 and Click Remove Volume Group. Click Yes to remove the volume group. Uninitializing a Physical Volume Uninitializing a physical volume removes all LVM metadata information from it. Use the pvremove command: # pvremove /dev/sdb You can use the LVM Configurator to uninitialize a physical volume. Follow the steps below to uninitialize /dev/sdb: Start LVM Configurator and go Unallocated Volumes /dev/sdb Partition 1. Click Remove Volume from LVM and then Yes to uninitialize /dev/sdb. |

Page 73: The output of the second awk command example on the page should have file owner name in the first column, file size in the second, and name of the file in the third column. Page 78: The default prompt for the C and TC shells is the % sign, and not the $ sign as stated. Page 92: The first command on the page has two double quotation marks with a single space in between: $ w | tr -s " " Page 100: The command line at the bottom should be read as: # com_line_arg.sh toronto chicago london tokyo Page 102: Line #11 in the inter_read.sh script should have -e option with the echo command, as follows: (incorrect) echo “Enter name of file you want to remove: c”. (correct) echo –e “Enter name of file you want to remove: c”. Page 108: The second nice command on the page should be read as: # nice --18 system-config-users Page 111: The last paragraph under Summary should say "Finally, you learned how to run commands immune to hangup signals.". Page 121: There is a typo under "Advanced Configuration and Power Interface". The first sentence should be read as "ACPI is a standard for ...... ". Page 128: There is a typo in the heading and it should be read as Major and Minor Numbers. Page 151: There is a typo in the name of the second category which should be read as Servers. Page 178: The second sentence under the heading Packages and Packaging should be read as "Files contained in a package include ...... " Page 179: The fourth sentence under the heading Package Database should be read as "The information contained herein helps ...... " Page 355: The word sinlge should be read as single in the 4th line. |