The LPIC-2 Exam Prep I
Total Page:16
File Type:pdf, Size:1020Kb
The LPIC-2 Exam Prep i The LPIC-2 Exam Prep Copyright 2013 Snow B.V. The LPIC-2 Exam Prep ii Copyright © 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Snow B.V. Copyright 2013 Snow B.V. The LPIC-2 Exam Prep iii COLLABORATORS TITLE : The LPIC-2 Exam Prep ACTION NAME DATE SIGNATURE WRITTEN BY Heinrich W. 2010 Klöpping, Beno T.J. Mesman, Piet W. Plomp, Willem A. Schreuder, Ricky Latupeirissa, Patryck Winkelmolen, Many, many Snow B.V. colleagues for peer reviewing and authoring updates., Jos Jansen, and Joost Helberg REVISION HISTORY NUMBER DATE DESCRIPTION NAME Copyright 2013 Snow B.V. The LPIC-2 Exam Prep iv Contents 0 Capacity Planning (200) 1 0.1 Measure and Troubleshoot Resource Usage (200.1) . .1 0.1.1 iostat .....................................................2 0.1.2 vmstat ....................................................2 0.1.3 netstat ....................................................3 0.1.4 ps .......................................................4 0.1.5 pstree .....................................................5 0.1.6 w .......................................................5 0.1.7 lsof ......................................................5 0.1.8 free ......................................................6 0.1.9 top . .6 0.1.10 uptime ....................................................7 0.1.11 sar ......................................................7 0.1.12 Match / correlate system symptoms with likely problems . .8 0.1.13 Estimate throughput and identify bottlenecks in a system including networking . .8 0.2 Predict Future Resource Needs (200.2) . .8 0.2.1 ........................................................9 0.2.2 Predict future growth . .9 0.2.3 Resource Exhaustion . .9 0.3 Questions and answers . 10 1 Linux Kernel (201) 11 1.1 Kernel Components (201.1) . 11 1.1.1 Different types of kernel images . 12 1.1.2 Overview of numbering schemes for kernels and patches . 12 1.1.3 Scheme up to 2.6.0 kernels . 12 1.1.4 Kernel Versioning since kernel version 2.6.0 and up to 3.0 . 12 1.1.5 Kernel Versioning since kernel version 3.0 . 13 1.1.6 What are kernel modules . 13 1.2 Compiling a Linux kernel (201.2) . 13 Copyright 2013 Snow B.V. The LPIC-2 Exam Prep v 1.2.1 Getting the kernel sources . 14 1.2.2 Cleaning the kernel . 15 1.2.3 Creating a .config file........................................... 15 1.2.4 make config ................................................ 16 1.2.5 make menuconfig ............................................. 17 1.2.6 make xconfig and gconfig ........................................ 18 1.2.7 make oldconfig .............................................. 21 1.2.8 Compiling the kernel . 21 1.2.8.1 make clean ............................................ 21 1.2.8.2 make zImage/bzImage ..................................... 21 1.2.8.3 make modules .......................................... 21 1.2.8.4 make modules_install .................................... 21 1.2.9 Installing the new kernel . 22 1.2.10 The initial ram disk (initrd)........................................ 22 1.2.11 Manual initrd creation . 22 1.2.12 Patching a Kernel . 24 1.2.13 Removing a kernel patch from a production kernel . 25 1.3 Kernel runtime management and troubleshooting (201.3) . 25 1.3.1 Customise, build and install a custom kernel and kernel modules . 26 1.3.1.1 Using kernel modules . 26 1.3.1.1.1 Manipulating modules . 27 1.3.1.1.1.1 lsmod . 27 1.3.1.1.1.2 insmod . 27 1.3.1.1.1.3 rmmod . 27 1.3.1.1.1.4 modprobe . 28 1.3.1.1.1.5 modinfo . 29 1.3.1.1.2 Configuring modules . 30 1.3.1.1.2.1 Module Dependency File . 31 1.3.1.2 kmod versus kerneld ....................................... 31 1.3.1.2.1 What are they? . 31 1.3.1.2.2 What is the difference between them? . 31 1.3.1.2.3 What do they have in common? . 31 1.3.1.2.4 Enabling kmod ..................................... 32 1.3.1.3 Building A Custom Kernel . 32 1.3.2 /proc filesystem . 32 1.3.3 Contents of /, /boot , and /lib/modules ............................... 32 1.3.4 Tools and utilities to trace software and their system and library calls . 33 1.3.4.1 strace . 33 1.3.4.2 strings . 34 Copyright 2013 Snow B.V. The LPIC-2 Exam Prep vi 1.3.4.3 ltrace . 35 1.3.4.4 uname . 36 1.3.4.5 Module dependencies . 36 1.3.4.6 Module configuration . 36 1.3.4.7 The bootprocess . 37 1.3.4.8 lspci . 37 1.3.4.9 lsusb . 38 1.3.4.10 lsdev . 38 1.3.4.11 sysctl . 39 1.3.4.12 dmesg . 39 1.3.4.13 udev rules . 39 1.3.4.14 /etc/udev/ . 40 1.3.4.15 udev rules . 40 1.3.4.16 udevmonitor . 40 1.4 Questions and answers . 40 2 System Startup (202) 42 2.1 Customising SysV-init system startup (202.1) . 42 2.1.1 Create initrd using mkinitrd ....................................... 43 2.1.2 Create initrd using mkinitramfs ..................................... 43 2.1.3 Setting the root device . 44 2.1.4 The Linux Boot process . 44 2.1.5 The init process . 45 2.1.5.1 Configuring /etc/inittab .................................. 45 2.1.5.2 The /etc/init.d/rc script . 47 2.1.6 update-rc.d .................................................. 48 2.1.7 The LSB standard . 49 2.1.8 The bootscript environment and commands . 50 2.1.8.1 Changing and configuring runlevels . 50 2.1.8.2 The chkconfig command . 50 2.2 System recovery (202.2) . 52 2.2.1 GRUB explained . 52 2.2.2 Influencing the regular boot process . 54 2.2.2.1 Choosing another kernel . 54 2.2.2.2 Booting into single user mode or a specific runlevel . 54 2.2.2.3 Switching runlevels . 54 2.2.2.4 Passing parameters to the kernel . 55 2.2.2.4.1 If a device doesn’t work . 55 2.2.3 The Rescue Boot process . ..