07 booting and shutting down

download 07  booting and shutting down

If you can't read please download the document

Transcript of 07 booting and shutting down

  • 1. 17 Booting and shutting7 Booting and shuttingdowndownP2 Single host AdministrationP2 Single host Administration

2. 2Ni dung (tt)Ni dung (tt) Qu trnh boot Linux Boot loader (boot manager) Boot loader GRUB Boot loader LILO Kernel image v initrd Tin trnh init v file inittab Tin trnh rc.sysinit /etc/rc.d/rc script Qu trnh shutdown Linux 3. 3Qu trnh boot linuxQu trnh boot linux 4. 4Qu trnh boot LinuxQu trnh boot Linux BIOS/ POST MBR (lilo hoc grub): cho php la chn hiu hnh boot. Kernel + initrd: load kernel v detecthardware. Mount root file system (read only) /sbin/init: tin trnh cha ca mi tin trnh. /etc/inittab: quyt nh run level v gi startcc dch v cn thit ca run level . Hin th ha nu runlevel 5. 5. 5Boot loaderBoot loader Boot loader hay cn gi l boot manager cho phpqun l nhiu h iu hnh, chn boot vo h iuhnh no. Hai boot loader ph bin ca Linux: LILO (LInux LOader) GRUB (GRand Unified Boot loader) Khi thay i file cu hnh, GRUB t ng nhn bit,LILO th phi dng lnh /sbin/lilo update cu hnh. Ngy nay, GRUB l boot loader mc nh ca i as cc h iu hnh Linux. 6. 6Boot loader GRUBBoot loader GRUB File cu hnh grub.conf:default=0timeout=10splashimage=(hd0,0)/grub/splash.xpm.gzhiddenmenutitle Linux Fedora (2.6.5-1.358smp)root (hd0,0)kernel /vmlinuz-2.6.5-1.358smp ro root=LABEL=/ rhgbquietinitrd /initrd-2.6.5-1.358smp.imgtitle Windows server 20003rootnoverify (hd0,1)chainloader +1a u tin, partition u tin 7. 7Boot loader GRUB (tt)Boot loader GRUB (tt) Cch phn bit partition trong boot loaderGRUB khc vi cch thng thng caLinux. GRUB khng phn bit IDE, v SCSI. acng c hiu l: hd%d. %d: l s nguyn, bt u t zero chpartition u tin. LILO c cch hiu thng thng nh Linux:hdXY, sdXY. 8. 8Boot loader GRUB (tt)Boot loader GRUB (tt) Mt s lnh ca grub: s dng trong modegrub, hoc trong file grub.conf 9. 9Boot loader LILOBoot loader LILO File cu hnh lilo.conf:boot=/dev/hdaprompttimeout=10image=/boot/vmlinuz-2.6.5-1.358smplabel=Linux Fedora (2.6.5-1.358smp)root=/dev/hda1read-onlyother = /dev/hda2label=Windows server 2003table=/dev/hdaa IDE u tin, partition u tin 10. 10Boot loader LILO (tt)Boot loader LILO (tt) ci t LILO lm boot loader, dng lnh: /sbin/lilo yu cu phi c file lilo.conf G b boot loader LILO, dng lnh: /sbin/lilo u Tm hiu lnh lilo: man lilo Tm hiu file cu hnh boot loader lilo: man lilo.conf 11. 11Kernel image v initrdKernel image v initrd Kernel image l hnh nh nh nht ca kernelc nn thnh file vmlinuz-version.tar.gz. Kernel image cha nhng thnh phn quantrng cn thit u tin boot my tnh. initrd initial ram disk: c s dng detect phn cng v load driver. ng thi mount file systems di dng readonly tin hnh kim tra. 12. 12Tin trnh init v file inittabTin trnh init v file inittab Tin trnh init l cha ca mi tin trnh. Tin trnh init s tm c file /etc/inittab quyt nh runlevel no s c boot. Mi dng trong /etc/inittab c dng nh sau: id: runlevels:action:processNu khng nh ngha, sboot vo runlevel no??? 13. 13Tin trnh init (tt)Tin trnh init (tt) 14. 14Tin trnh rc.sysinitTin trnh rc.sysinit Tin trnh rc.sysinit thc thi nhng nhim v sau: thit lp hostname ca my tnh v detect mi trngnetwork. Mount /proc file system. Thit lp cc tham s ca kernel. Thit lp gi h thng, fonts. Khi to phn vng swap. Check file system v mount li mode read-write. Load nhng module cn thit. 15. 15/etc/rc.d/rc script/etc/rc.d/rc script Thc thi tt c script lin quan n run level. Vd: nu runlevel l 5, s gi thc thi ccscript trong /etc/rc.d/rc5.d Cc script ny l file symbolic link, link ncc script tht s, thng cha trong/etc/init.dstartstop 16. 16/etc/rc.d/rc script (tt)/etc/rc.d/rc script (tt) Nhng script c bt u bng S, h thng s gi chy lnh:/etc/rc.d/init.d/ start. Nhng script bt u bng K, h thng s gi chy lnh:/etc/rc.d/init.d stop. 17. 17Qu trnh shut down linuxQu trnh shut down linux 18. 18Hi & pHi & p