advertisement
Table of Contents
145
Chapter 14. bootloader
This chapter briefly discusses the boot sequence of an (Intel 32-bit or 64-bit) Linux computer.
Systems booting with lilo are rare nowadays, so this section is brief.
The most common bootloader on Linux systems today is grub, yet this is not a Linux project.
Distributions like FreeBSD and Solaris also use grub.
Likewise, grub is not limited to Intel architecture. It can also load kernels on PowerPC.
Note that grub, while still the default in Debian, is slowly being replaced in most distributions with grub2.
146
bootloader
14.1. boot terminology
The exact order of things that happen when starting a computer system, depends on the hardware architecture (Intel x86 is different from Sun Sparc etc), on the boot loader (grub is different from lilo) and on the operating system (Linux, Solaris, BSD etc). Most of this chapter is focused on booting Linux on Intel x86 with grub.
14.1.1. post
A computer starts booting the moment you turn on the power (no kidding). This first process is called post or power on self test. If all goes well then this leads to the bios. If all goes not so well, then you might hear nothing, or hear beeping, or see an error message on the screen, or maybe see smoke coming out of the computer (burning hardware smells bad!).
14.1.2. bios
All Intel x86 computers will have a basic input/output system or bios to detect, identify and initialize hardware. The bios then goes looking for a boot device. This can be a floppy, hard disk, cdrom, network card or usb drive.
During the bios you can see a message on the screen telling you which key (often Del or
F2) to press to enter the bios setup.
147
bootloader
14.1.3. openboot
Sun sparc systems start with openboot to test the hardware and to boot the operating system.
Bill Callkins explains openboot in his Solaris System Administration books. The details of
openboot are not the focus of this course.
14.1.4. boot password
The bios allows you to set a password. Do not forget this password, or you will have to open up the hardware to reset it. You can sometimes set a password to boot the system, and another password to protect the bios from being modified.
14.1.5. boot device
The bios will look for a boot device in the order configured in the bios setup. Usually an operating system on a production server boots of a hard disk.
148
bootloader
14.1.6. master boot record
The master boot record or mbr is the first sector of a hard disk. The partitioning of a disk in primary partitions, and the active partition are defined in the mbr.
The mbr is 512 bytes long and can be copied with dd.
dd if=/dev/sda of=bootsect.mbr count=1 bs=512
14.1.7. bootloader
The mbr is executed by the bios and contains either (a small) bootloader or code to load a bootloader.
Looking at the mbr with od can reveal information about the bootloader.
paul@laika:~$ sudo dd if=/dev/sda count=1 bs=16 skip=24 2>/dev/null|od -c
0000000 376 G R U B \0 G e o m \0 H a r d
0000020
There are a variety of bootloaders available, most common on Intel architecture is grub, which is replacing lilo in many places. When installing Linux on sparc architecture, you can choose silo, Itanium systems can use elilo, IBM S/390 and zSeries use z/IPL, Alpha uses milo and PowerPC architectures use yaboot (yet another boot loader).
Bootable cd's and dvd's often use syslinux.
14.1.8. kernel
The goal of all this is to load an operating system, or rather the kernel of an operating system.
A typical bootloader like grub will copy a kernel from hard disk to memory, and will then hand control of the computer to the kernel (execute the kernel).
Once the Linux kernel is loaded, the bootloader turns control over to it. From that moment on, the kernel is in control of the system. After discussing bootloaders, we continue with the
init system that starts all the daemons.
149
advertisement
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Related manuals
advertisement
Table of contents
- 8 I. process management
- 10 1. introduction to processes
- 11 1.1. terminology
- 12 1.2. basic process management
- 16 1.3. signalling processes
- 19 1.4. practice : basic process management
- 20 1.5. solution : basic process management
- 22 2. process priorities
- 23 2.1. priority and nice values
- 26 2.2. practice : process priorities
- 27 2.3. solution : process priorities
- 29 3. background jobs
- 30 3.1. background processes
- 32 3.2. practice : background processes
- 33 3.3. solution : background processes
- 35 II. disk management
- 38 4. disk devices
- 39 4.1. terminology
- 41 4.2. device naming
- 42 4.3. discovering disk devices
- 47 4.4. erasing a hard disk
- 48 4.5. advanced hard disk settings
- 49 4.6. practice: hard disk devices
- 50 4.7. solution: hard disk devices
- 52 5. disk partitions
- 53 5.1. about partitions
- 54 5.2. discovering partitions
- 56 5.3. partitioning new disks
- 58 5.4. about the partition table
- 59 5.5. practice: partitions
- 60 5.6. solution: partitions
- 61 6. file systems
- 62 6.1. about file systems
- 63 6.2. common file systems
- 66 6.3. putting a file system on a partition
- 67 6.4. tuning a file system
- 68 6.5. checking a file system
- 69 6.6. practice: file systems
- 70 6.7. solution: file systems
- 71 7. mounting
- 72 7.1. mounting local file systems
- 73 7.2. displaying mounted file systems
- 75 7.3. from start to finish
- 76 7.4. permanent mounts
- 77 7.5. securing mounts
- 78 7.6. mounting remote file systems
- 79 7.7. practice: mounting file systems
- 80 7.8. solution: mounting file systems
- 82 8. troubleshooting tools
- 83 8.1. lsof
- 84 8.2. fuser
- 85 8.3. chroot
- 86 8.4. iostat
- 86 8.5. iotop
- 87 8.6. practice: troubleshooting tools
- 36 8.7. solution: troubleshooting tools
- 37 9. introduction to uuid's
- 38 9.1. about unique objects
- 38 9.2. tune2fs
- 38 9.3. uuid
- 39 9.4. uuid in /etc/fstab
- 40 9.5. uuid as a boot device
- 41 9.6. practice: uuid and filesystems
- 42 9.7. solution: uuid and filesystems
- 43 10. introduction to raid
- 43 10.1. hardware or software
- 44 10.2. raid levels
- 46 10.3. building a software raid5 array
- 49 10.4. practice: raid
- 50 10.5. solution: raid
- 51 11. logical volume management
- 52 11.1. introduction to lvm
- 53 11.2. lvm terminology
- 54 11.3. example: using lvm
- 56 11.4. example: extend a logical volume
- 58 11.5. example: resize a physical Volume
- 60 11.6. example: mirror a logical volume
- 61 11.7. example: snapshot a logical volume
- 62 11.8. verifying existing physical volumes
- 64 11.9. verifying existing volume groups
- 65 11.10. verifying existing logical volumes
- 66 11.11. manage physical volumes
- 68 11.12. manage volume groups
- 70 11.13. manage logical volumes
- 72 11.14. practice : lvm
- 73 11.15. solution : lvm
- 77 12. iSCSI devices
- 78 12.1. iSCSI terminology
- 78 12.2. iSCSI Target in RHEL/CentOS
- 80 12.3. iSCSI Initiator in RHEL/CentOS
- 82 12.4. iSCSI target on Debian
- 83 12.5. iSCSI target setup with dd files
- 85 12.6. ISCSI initiator on ubuntu
- 87 12.7. using iSCSI devices
- 88 12.8. practice: iSCSI devices
- 89 12.9. solution: iSCSI devices
- 90 13. introduction to multipathing
- 91 13.1. install multipath
- 91 13.2. configure multipath
- 92 13.3. network
- 92 13.4. start multipathd and iscsi
- 94 13.5. multipath list
- 95 13.6. using the device
- 96 13.7. practice: multipathing
- 97 13.8. solution: multipathing
- 99 III. boot management
- 101 14. bootloader
- 102 14.1. boot terminology
- 105 14.2. grub
- 110 14.3. grub
- 111 14.4. lilo
- 112 14.5. practice: bootloader
- 113 14.6. solution: bootloader
- 153 15. init and runlevels
- 154 15.1. system init(ialization)
- 159 15.2. daemon or demon ?
- 159 15.3. starting and stopping daemons
- 160 15.4. chkconfig
- 162 15.5. update-rc.d
- 163 15.6. bum
- 164 15.7. runlevels
- 166 15.8. systemd
- 166 15.9. other systemd tools
- 168 15.10. practice: init
- 169 15.11. solution : init
- 171 IV. system management
- 173 16. scheduling
- 174 16.1. one time jobs with at
- 176 16.2. cron
- 178 16.3. practice : scheduling
- 179 16.4. solution : scheduling
- 180 17. logging
- 181 17.1. login logging
- 184 17.2. syslogd
- 187 17.3. logger
- 187 17.4. watching logs
- 188 17.5. rotating logs
- 189 17.6. practice : logging
- 190 17.7. solution : logging
- 192 18. memory management
- 193 18.1. displaying memory and cache
- 194 18.2. managing swap space
- 196 18.3. monitoring memory with vmstat
- 197 18.4. practice : memory
- 198 18.5. solution : memory
- 199 19. monitoring
- 200 19.1. top
- 200 19.2. free
- 201 19.3. watch
- 201 19.4. vmstat
- 202 19.5. iostat
- 203 19.6. mpstat
- 203 19.7. sadc and sar
- 204 19.8. ntop
- 204 19.9. iftop
- 204 19.10. iptraf
- 205 19.11. nmon
- 205 19.12. htop
- 206 20. RPM package management
- 207 20.1. package terminology
- 209 20.2. deb package management
- 211 20.3. apt-get
- 214 20.4. aptitude
- 215 20.5. apt
- 216 20.6. rpm
- 218 20.7. yum
- 225 20.8. alien
- 226 20.9. downloading software outside the repository
- 226 20.10. compiling software
- 227 20.11. practice: RPM package management
- 228 20.12. solution: RPM package management
- 194 V. network management
- 197 21. general networking
- 198 21.1. network layers
- 201 21.2. unicast, multicast, broadcast, anycast
- 203 21.3. lan-wan-man
- 205 21.4. internet - intranet - extranet
- 206 21.5. tcp/ip
- 207 22. interface configuration
- 208 22.1. to gui or not to gui
- 209 22.2. Debian/Ubuntu nic configuration
- 211 22.3. Red Hat/Fedora nic configuration
- 213 22.4. ifconfig
- 215 22.5. hostname
- 216 22.6. arp
- 217 22.7. route
- 217 22.8. ping
- 218 22.9. optional: ethtool
- 219 22.10. practice: interface configuration
- 220 22.11. solution: interface configuration
- 222 23. network sniffing
- 223 23.1. wireshark
- 225 23.2. tcpdump
- 226 23.3. practice: network sniffing
- 227 23.4. solution: network sniffing
- 228 24. binding and bonding
- 229 24.1. binding on Redhat/Fedora
- 230 24.2. binding on Debian/Ubuntu
- 231 24.3. bonding on Redhat/Fedora
- 233 24.4. bonding on Debian/Ubuntu
- 235 24.5. practice: binding and bonding
- 236 24.6. solution: binding and bonding
- 237 25. ssh client and server
- 238 25.1. about ssh
- 240 25.2. log on to a remote server
- 240 25.3. executing a command in remote
- 241 25.4. scp
- 242 25.5. setting up passwordless ssh
- 243 25.6. X forwarding via ssh
- 244 25.7. troubleshooting ssh
- 245 25.8. sshd
- 245 25.9. sshd keys
- 245 25.10. ssh-agent
- 246 25.11. practice: ssh
- 247 25.12. solution: ssh
- 249 26. introduction to nfs
- 250 26.1. nfs protocol versions
- 250 26.2. rpcinfo
- 251 26.3. server configuration
- 251 26.4. /etc/exports
- 251 26.5. exportfs
- 252 26.6. client configuration
- 253 26.7. practice: introduction to nfs
- 254 27. introduction to networking
- 255 27.1. introduction to iptables
- 256 27.2. practice : iptables
- 257 27.3. solution : iptables
- 258 27.4. xinetd and inetd
- 260 27.5. practice : inetd and xinetd
- 309 27.6. network file system
- 311 27.7. practice : network file system
- 312 VI. kernel management
- 314 28. the Linux kernel
- 315 28.1. about the Linux kernel
- 318 28.2. Linux kernel source
- 322 28.3. kernel boot files
- 324 28.4. Linux kernel modules
- 329 28.5. compiling a kernel
- 332 28.6. compiling one module
- 334 29. library management
- 335 29.1. introduction
- 335 29.2. /lib and /usr/lib
- 335 29.3. ldd
- 336 29.4. ltrace
- 336 29.5. dpkg -S and debsums
- 337 29.6. rpm -qf and rpm -V
- 338 29.7. tracing with strace
- 339 VII. backup management
- 341 30. backup
- 341 30.1. About tape devices
- 342 30.2. Compression
- 342 30.3. tar
- 344 30.4. Backup Types
- 345 30.5. dump and restore
- 345 30.6. cpio
- 346 30.7. dd
- 347 30.8. split
- 347 30.9. practice: backup
- 349 VIII. Appendices
- 351 A. disk quotas
- 351 A.1. About Disk Quotas
- 351 A.2. Practice Disk quotas
- 352 B. introduction to vnc
- 352 B.1. About VNC
- 352 B.2. VNC Server
- 352 B.3. VNC Client
- 353 B.4. Practice VNC
- 354 C. License
- 361 Index