Thursday, December 30, 2010

Linux administrator's manual (5)--boot and shutdown

-This section explains when Linux system boot and shutdown what occurred, should any completed correctly without follow the correct procedure, the file may be corrupt or missing.

Boot and shutdown overview on your computer and cause the operating system is loaded by the process called boot .Thenamecomesfromanimageofthecomputerpullingitselfupfromitsbootstraps, buttheactitselfslightlymorerealistic. During startup, the computer first loads a small program called bootstraploader, which, in turn, load and start the operating system, bootstraploader is usually stored in your hard disk or a floppy disk in a fixed location this 2-step process of grounds is large and complex, the operating system and computer loads the first piece of code is very small (a few hundred bytes), so as not to unnecessarily complicate the firmware. Different computer bootstrap different computer for PC, (it's BIOS) reading the floppy disk or hard disk the first sector (called boot sector) .bootstraploader included in this sector is located on the disk to load it (and other) in other parts of the operating system. Linux loaded, its founding of hardware and device driver, and then start another process running init.init to allow users to log on and do other things. this part of the detail in the following discussion. In order to close a Linux system, first of all the processes are told to end (this allows them to close all files, complete the necessary other things that make them neatly end), and then unmount file systems and the swap area, the last print can turn off the power of information to the console if not followed the correct procedure, terrible things may happen. the most important, file system, buffer cache may not write back, which means that all data will be lost and disk file system is not complete, and may not be available. A closer look at the boot process can boot from the floppy or hard drive installed and start Linux. Guide to the installation section ([Wel]) to tell you how to install Linux, and the way you want to boot. When the PC boots, the BIOS to do some testing ensure that everything is normal, and then start the real boot it select a disk (usually the first floppy drive, if you have a floppy disk, otherwise it is the first hard disk, if you installed Word; sequence is settable)-and then read the first sector, this is called the boot sector; for hard drives, also called the master boot record, because the hard disk can contain multiple partitions, each partition has its own boot sector. Boot sector contains a small program (as small as you can into a sector), it is the responsibility of reading from disk and start a real operating systems of Linux from a floppy disk boot-time, boot sector contains code read-only before hundreds of data blocks (of course, depend on the core size) to a predetermined memory location .Linux boot floppy, no file system, core exists continuous sector, because this simplifies the boot process. of course, use LILO (LInuxLOader) from the file system boot. Boot from the hard disk, the master boot record partition table of code review (also in the master boot record sector), confirm the active partition (for marked as bootable partition), read from the partition boot sector, and then starts the boot sector code. the partition boot sector code to do with the same floppy disk: the boot partition into the core and the details are different, however, since usually only to core image to make a separate partition is not used, the partition boot sector code can not read disks only order, it must locate the file system to put them in what sector. There are several methods to resolve this problem, but the most common method is to use LILO. (Details on how to do it with irrelevant here; for more information please look at the LILO documentation, it's very comprehensive) using LILO boot time, it reads and boot the default core. you can also set the LILO, boot one of several core, or even other operating systems, you can boot time which allows the user to select a boot kernel or operating system .LILO can be set to if someone at boot time by pressing ALT, shift, orctrl keys (LILO starts), LILO will not immediately boot default and ask user guide which can be set to bring .LILO a timeout options and asks, when the time-out, then boot the default core. META: there are other than LILO boot loader, such as loadlin, their information will be in the next version in. Boot from the floppy and hard disks have advantages, but it is usually better to boot from the hard drive, because it avoids the controversy on floppy disks and quickly however., install the same boot from the hard drive may have more trouble, so many people to use a floppy disk boot, and then when the same work very well, and then install the LILO boot from the hard drive. Linux core is read into memory, it really started, summarized as follows: Linux core is installed is compressed, it first had to extract core mappings. include an extract of the beginning of the applet. If you have Linux recognizable super-VGA card, and to support some special text mode (such as 100 columns 40 rows), Linux will ask you to use when compiling the kernel mode., may have booked a video mode, will not be asked. this you can also use LILO or rdev completed. Then, check what other core hardware (hard disk, floppy disk, NIC ...), and configure the appropriate device driver; at the same time, the output of the find results information. for example, I get the boot-time, similar to the following information: LILOboot: Loadinglinux. Console:colourEGA+80x25,8virtualconsoles  Serialdriverversion3.94withnoserialoptionsenabled  tty00at0x03f8(irq=4)isa16450  tty01at0x02f8(irq=3)isa16450  lp_init:lp1exists(0),usingpollingdriver  Memory:7332k/8192kavailable(300kkernelcode,384kreserved,176kdata)  Floppydrive(s):fd0is1.44M,fd1is1.2M  Loopbackdeviceinit  WarningWD8013boardnotfoundati/o=280. Mathcoprocessorusingirq13errorreporting. Partitionceck:  hda:hda1hda2da3  VFS:Mountedroot(extfilesystem). Linuxversion0.99.pl9-1root @ haven) 05/01/20 12: 9314: exact text different on different systems, rely on the hardware, the Linux version, and its configuration. And then the core tries to mount the root file system where you can compile-time settings, or at any time using rdev or LILO. file system type autodetection. If failed to mount the root file system, for example because you forgot the core contains the relevant file system driver that core will fail, the system stops (has nothing to do at this time). The root file system is usually read-only mount (this is available in the same way as with the location). This makes the file system check on the mount; check a read/write file system mount is not a good idea. Then, start the program in the background the core init (located at/sbin/init) (its process number is 1.) start work .init do many things-exact is dependent on set; see chapter for more information. it at least to start some essential background daemons. Init and then switch to multi-user mode and start getty, offer virtual console and the serial line .getty is a user through the virtual console and the serial terminal login program some .init also may start the other program, based on the settings. At this point, boot completed, the system up and running. For more information about Shutdown Shutdown Linux system, follow the correct procedure is very important. Otherwise, the file system may become waste, the file may become cluttered. This is because Linux use the disk cache and the data is not immediately written to disk, which is intermittently write back. This greatly improves performance, but it also means that if you just turn off the power, the cache may keep large amounts of data, and data on disk may not be a full working file system (because some of the data is written back to disk, and some not). Another cannot directly off the power of reason: in a multitasking system, the background may run with a lot of things, turns off the power supply possible losses. Use the correct shutdown sequence, you can ensure that all of the background process to save their data. Graceful shutdown of the Linux system commands is shutdown. It typically use 2 methods. If the system has only one user, use the shutdown of general approach is to quit all running programs, log off from all virtual console, root login (if you are root, of course, do not have to log off, log on, but it should change to the root directory to avoid problems due to unmount), and then run the command shutdown-hnow (although single user is generally not necessary, but if you need a delay, use a plus sign and a representation of the number of minutes in place now) if the system is multi-user, use command shutdown-h + timemessage, time is the number of minutes the system stops, the message is to inform all users of the system shutdown reason of SMS. #shutdown-h+10'Wewillinstallanewdisk.Systemsould  >bebackon-lineinthreehours.' # Above command warning all users, the system will shut down after 10 minutes, they'd better save information that otherwise would be lost. A warning will be displayed in all logins on the Terminal, including all the xterm: Broadcastmessagefromroot (ttyp0) WedAug201: 03 251995 ... Wewillinstallanewdisk.Systemsould  bebackon-lineinthreehours. ThesystemisgoingDOWNforsystemhaltin10minutes!! Warning before the system shuts down automatically repeating several times, as time goes by, more and more short intervals. When delay after shutting down the system at the beginning of the genuinely, all file systems (except root) are all user processes unmount, (if someone has not cancelled) is terminated, all processes are closed, everything stopped. Since then, the init to print out a message telling you to turn off the power. At this point, and only then, you can turn off the power. Sometimes (although in any good system rarely), the system may not be able to close gracefully. For example, nuclearHeart disorder, crashes, and other unusual circumstances, may not be able to type any command, so the normal shutdown may have some difficulty, this is the only direct power off. The problem may not be so serious, for example, some malfunction of your keyboard, core and update program still running, waiting for some time may be a good idea, this can make the update have the opportunity to the data in the buffer cache huicun hard disk, and then direct to shut down. Some people like to use sync three times to turn off the system, wait until the disk i/o, and then turn off the power. If no program is running, and the use of equivalent shutdown. However, it does not unmount any file system that may cause the ext2fs "clean file system" sign out. This 3 x sync method is deprecated. (Incaseyou'rewondering:thereasonforthreesyncsisthatintheearlydaysofUNIX,whenthecommandsweretypedseparately,thatusuallygavesufficien

No comments:

Post a Comment