wordpress网站后台,手机网站建设策划,微信网页版公众号网站怎么做,网站会员体系方案Linux系统中启动的流程:1.加载bios的硬件信息以及进行自我检测 并根据设置取得第一个启动的设备2.若以硬盘方式引导 读取并执行引导扇区 MBR3.加载grub(引导程序)启动菜单(/\)4.加载内核(以只读方式进行挂载)5.挂载根目录系统 启动init进程(所有进程的鼻祖)6.读取/etc/initt…Linux系统中启动的流程:1.加载bios的硬件信息以及进行自我检测 并根据设置取得第一个启动的设备2.若以硬盘方式引导 读取并执行引导扇区 MBR3.加载grub(引导程序)启动菜单(/\)4.加载内核(以只读方式进行挂载)5.挂载根目录系统 启动init进程(所有进程的鼻祖)6.读取/etc/inittab配置文件7.执行/etc/rc.d/rc.sysint脚本8.根据/etc/initab文件下的启动级别执行/etc/rc.d/rc下的脚本9.执行/etc/rc.d/rc.local(开机脚本 期望开机自动执行的指令可以放在这个脚本里)分析/etc/inittab文件--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------1 #2 # inittab This file describes how the INIT process should set up3 # the system in a certain run-level.4 #5 # Author: Miquel van Smoorenburg, 6 # Modified for RHS Linux by Marc Ewing and Donnie Barnes7 #89 # Default runlevel. The runlevels used by RHS are:10 # 0 - halt (Do NOT set initdefault to this)#(10-16行指的是启动级别)#关机11 # 1 - Single user mode#单用户模式 通常用于维护系统12 # 2 - Multiuser, without NFS (The same as 3, if you do not have networking)#多用户模式 但是无网络13 # 3 - Full multiuser mode#多用户模式(字符界面)14 # 4 - unused#用户定义 未定义情况下与3级别相同15 # 5 - X11#图形界面16 # 6 - reboot (Do NOT set initdefault to this)#系统重启17 #18 id:3:initdefault:#第一列表示表示怎么表示无所谓 第二列表示启动级别 第三列表示动作 第四列表示参数 如果级别列无任何标示表示任何级别 该句话表示默认启动级别为三1920 # System initialization.21 si::sysinit:/etc/rc.d/rc.sysinit#参考十八行 第一列表示标示 第二列无表示 代表进入任何级别都要执行该指令 第三行表示动作 表示进行初始化 第四行表示执行/etc/rc.d/rc.sysinit脚本2223 l0:0:wait:/etc/rc.d/rc 024 l1:1:wait:/etc/rc.d/rc 124 l1:1:wait:/etc/rc.d/rc 125 l2:2:wait:/etc/rc.d/rc 226 l3:3:wait:/etc/rc.d/rc 327 l4:4:wait:/etc/rc.d/rc 428 l5:5:wait:/etc/rc.d/rc 529 l6:6:wait:/etc/rc.d/rc 6#参考十八行 最后一个数字表示将此数字传递给/etc/rc.d/rc脚本如传递3那么就会执行/etc/rc.d/rc3.d3031 # Trap CTRL-ALT-DELETE32 ca::ctrlaltdel:/sbin/shutdown -t3 -r now#参考十八行 表示在任何级别下都可以使用ctrlaltdel执行/sbin/shutdown -r表示关机并重新启动系统,默认三秒后立即执行3334 # When our UPS tells us power has failed, assume we have a few minutes35 # of power left. Schedule a shutdown for 2 minutes from now.36 # This does, of course, assume you have powerd installed and your37 # UPS connected and working correctly.38 pf::powerfail:/sbin/shutdown -f -h 2 Power Failure; System Shutting Down#系统断电后 执行/sbin/shutdown -h表示关机之后不重新启动-f表示重新启动不执行fsck 2分钟之后执行 并显示 提示信息3940 # If power was restored before the shutdown kicked in, cancel it.41 pr:12345:powerokwait:/sbin/shutdown -c Power Restored; Shutdown Cancelled#电力恢复之后取消已经运行的shutdown指令 并提示信息424344 # Run gettys in standard runlevels45 1:2345:respawn:/sbin/mingetty tty146 2:2345:respawn:/sbin/mingetty tty247 3:2345:respawn:/sbin/mingetty tty348 4:2345:respawn:/sbin/mingetty tty449 5:2345:respawn:/sbin/mingetty tty550 6:2345:respawn:/sbin/mingetty tty6#/sbin/mingetty 表示产生字符终端 共六个字符终端respawn表示再生的意思 即当前的终端注销后 仍然在一个终端里5152 # Run xdm in runlevel 553 x:5:respawn:/etc/X11/prefdm -nodaemon~~-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------~启动故障可分为两大阶段1.系统引导扇区MBR出现问题2.Grub菜单出现问题1.模拟MBR扇区出现故障创建一个文件覆盖整个硬盘[rootlocalhost ~]# dd if/dev/zero of/dev/sda bs446 count1MBR扇区被覆盖 引导程序抹掉了解决方式重建MBR用可安装光盘引导在此界面下进入急救模式输入linux resuce选择语言鼠标键盘类型是否启动网络功能 没有必要关于急救模式的提示硬盘将会挂载在/mnt/p_w_picpath提示将./mnt/sysp_w_picpath当做系统根目录使用chroot指令指定硬盘的根目录#chroot /mnt/sysp_w_picpath修复分区表 执行grup指令#grub1.先指明引导系统 执行root指令#root (hd0,0) (第一块硬盘第一块分区)2.执行setup可以帮助重新建mbr#setuo hd0执行一次quit两次exit系统进行重新启动二.GRUB引导菜单出现故障查看/boot/grub[rootlocalhost ~]# ll /boot/grub在所有文件中最为重要的是grub.conf文件----------------------------------------------------------------------------------------------------------------------1 # grub.conf generated by anaconda2 #3 # Note that you do not have to rerun grub after making changes to this file4 # NOTICE: You have a /boot partition. This means that5 # all kernel and initrd paths are relative to /boot/, eg.6 # root (hd0,0)7 # kernel /vmlinuz-version ro root/dev/sda28 # initrd /initrd-version.img9 #boot/dev/sda10 default0#默认操作系统11 timeout5#超时时间5s12 splashp_w_picpath(hd0,0)/grub/splash.xpm.gz#grub菜单背景图片13 hiddenmenu14 title Red Hat Enterprise Linux Server (2.6.18-164.el5)#标签15 root (hd0,0)#引导分区MBR16 kernel /vmlinuz-2.6.18-164.el5 ro rootLABEL/ rhgb quiet#内核文件位置 以只读方式进行 系统启动后根目录变成文件系统的根quiet静默17 initrd /initrd-2.6.18-164.el5.img#驱动故障一.故障1.删除了grub.conf[rootlocalhost ~]# rm /boot/grub/grub.confrm: remove regular file /boot/grub/grub.conf? y[rootlocalhost ~]# cd /boot/grub重启Grub直接启动表明第二阶段有问题指明引导分区#root(hd0,0) (第一块硬盘第一块分区)grubhelp可以查看可以执行的指令查看根目录grup find /执行kernel /vmlinuz-2.6-164.e15 ro root/dev/sda2 quitInitrd /initrd-2.6.18-164.e15.img执行完成后启动 grubboot启动完成进入系统后使用grub-install产生二阶段的其他文件--------------------------------------------------------------------------------[rootlocalhost ~]# grub-installinstall_device not specified.Usage: grub-install [OPTION] install_deviceInstall GRUB on your drive.-h, --help print this message and exit-v, --version print the version information and exit--root-directoryDIR install GRUB p_w_picpaths under the directory DIR#指明这些文件的目录instead of the root directory--grub-shellFILE use FILE as the grub shell--no-floppy do not probe any floppy drive--force-lba force GRUB to use LBA mode even for a buggyBIOS--recheck probe a device map even if it already existsThis flag is unreliable and its use isstrongly discouraged.INSTALL_DEVICE can be a GRUB device name or a system device filename.grub-install copies GRUB p_w_picpaths into the DIR/boot directory specfied by--root-directory, and uses the grub shell to install grub into the bootsector.Report bugs to .[rootlocalhost ~]# grub-install --root-directory/boot/grub /dev/sdaGrub.conf文件丢失需重新编写重启故障二 /boot目录下的所有内容被删a.删除/boot下的所有内容rm -rf /boot/*b.重启c.进入bios设置 将光驱设置为首先启动d.进入救援模式linux rescuee.使用chroot指令切换到硬盘的目录Chroot /mnt/sysp_w_picpathf.切换到boot目录并查看内容cd /boot lsg.挂载光驱Mount /dev/hdc /mnth.安装内核 内核安装完成后会自动安装initrdRpm -ivh --force /mnt/Server/kernel-2.6.18-164.e15.i686.rpmi.内核安装完成之后我们安装grub grub-install /dev/sdaj.再次查看/boot目录下的内容k.查看grub的内容发现缺少grub.conf重新编写grub.conf#cd /boot/grub/#touch grub.conf#vim grub.confl.两次exit退出重启 重启要设置bios为硬盘启动故障三 删除了/grub下的内容依据故障二重复第a.c.e.j.l即可故障四文件系统表改变vim /etc/fstab如果误操作其中一个例如重新启动后会出现输入管理员密码编辑vim /etc/fstab重新挂载 mount -o remount / 然后再编辑重启