linux常见故障以及修复办法

上传人:lis****210 文档编号:158498370 上传时间:2022-10-05 格式:DOCX 页数:21 大小:478.39KB
收藏 版权申诉 举报 下载
linux常见故障以及修复办法_第1页
第1页 / 共21页
linux常见故障以及修复办法_第2页
第2页 / 共21页
linux常见故障以及修复办法_第3页
第3页 / 共21页
资源描述:

《linux常见故障以及修复办法》由会员分享,可在线阅读,更多相关《linux常见故障以及修复办法(21页珍藏版)》请在装配图网上搜索。

1、查看开机启动顺序: 2chroot: 3用 grub 来引导 6GRUB的概述6基本说明: 6具体的案例: 7模拟一些常见问题并且修复 9破坏了 sda的MBR中的引导程序9破坏几个重要的文件: 111)人为的删除系统关键文件: 112)修复linux系统122.还原 fstab 文件。 133修复内核和grub 14修复/etc/inittab 等文件:17遇到的问题: 17查看开机启动顺序:Minimal BfiSH-1ike 1ine md辻ing is supported. For the first uord, TAB 1ists possible comnand complet i

2、ons. Anuhere else TAB 1ists the pDssible comp let ions of a deu ice/f ilename. ESC ai any t ime cancels. ENTER nti ime accepts yunr 匚hanges.grub edit initrd /initranfs-2.6.32-220.el6.x86_64.ing|3.启动 initi 进程开始执行 rc.sysinit 脚本然后初始化环境。We lcome1 to R 已 d Hat Enterprise L imix SeruerStarting udeu: pi ix

3、4_smbus 0000:00:07,3: Host SMBus controller not enflbled* UK Setting hosthiame xeruer . longl in . com: DK Setting up LagicoLl Uo 1 umc Maoacjemeinit:No vo 1 umc groups f oiiodOK Check i ny f ilesysternsdEv/3tla2 : clean j 49871/969992 f i lesj 401297/384000U hlocks zdeuxsflal: recouering Journal/de

4、v/stial: clcsm j aB/SIZBB f i 1 es j 3420B/20480B blocks4.挂载文件系统,下面显示的是/etc/fstab开机挂载的东西。Remounting root f ilesystem in read-urite mode:LOKJMounting loca L f i lesystems:OKEnabling locaL filesystem quotas:OKEnabling /etc/fstab suaps:Entfir i hq nnn- i nt Fir Art i ur stflrtupCall ing the system acti

5、vity data co 1 lector* (sadc):OKiptablcs: App Lying f ircua11 rules:OKBringing up loopback interface:Bringing up interface ethB:D亡termirinif IP inf armat ion f or ethB . . . done .OKchroot:Linux下的chroot,即change root意为切换用户的根目录,例如将/opt/chroot/目录做为某个 用户的根目录,如此将锁定用户在该目录下,从而防止用户访问系统的重要文件进行窃密, 或防止用户执行危险操作

6、带来系统损害。另外,如果某些对外开放的服务(如Apache),一旦被入侵者控制,该入侵者将可能得到系 统用户的权限,从而控制整个系统,将这些服务置入chroot环境中运行,即使该入侵者控 制了该服务,也还在chroot下,需要更多的时间对chroot进行破解,这样就达到了加固的 目的。什么是 shell?Shell 俗称壳(用来区别于核),是指“提供使用者使用界面”的软件(命令解析器)。它类 似于DOS下的command和后来的cmd.exe。它接收用户命令,然后调用相应的应用程序 shell是用户和Linux内核之间的接口程序,如果把Linux内核想象成一个球体的中心,shell 就是围绕内

7、核的外层。当从shell或其他程序向Linux传递命令时,内核会做出相应的反应。shell是一个命令语言解释器,它拥有自己内建 的 shell 命令集, shell 也能被系统中其他应用程序所调用。用户在提示符下输入的命令都由shell先解释然后传给Linux核心。liliUXPJ H Mi构I,bin/sh是一个软连接,在windows系统中相当于快捷方式,要看你的linux系统的软连接的 指向,如果软连接指向的是bin/bash那么,bin/sh和bin/bash是一样的,但如果你的bin/sh 指向的是bin/csh或者bin/ksh那么bin/sh与bin/bash是就是一样的了。ro

8、otOlacalhost -# Is -1 /bnn/sh1rwxrwKrwx. 1 root root 4 Sep 16 05/bln/sh - bashM创造一个简单话的可登陆的 chroot 环境:rooxloCNlhost longl i nJ# ctiroor /home/longli n/chroot/chroot: failed to run 匚ommand /bin/bash1: No such file or di rectory, eitji _! i ii接着上面的来:chroot以后,系统的根目录切到/opt/chroot下,新的环境将继承旧系统的环境变量,root 用

9、户依然以/bin/bash为默认的shell,因/opt/chroot下并不存在bin/bash这个文件,所以报 上述错误,为了解决该问题,在该目录下建立bin目录,并拷贝bash文件到该目录下:r oti&locaI hostmkdi r /home/1 ongl i n/chroot/bT 门rocalhostcp -av /bin/bash /home/longl 1 n/chroot/bin/ /bi n/bash - /home/longlin/chr。上/山亓门/bmEhroot1 ocalhostthroot /home/longlin/chroot./chroot: fai1e

10、d to run command R/bin/5ash : No such file or directory原因分析:因为/bin/bash需要调用相关的库,因新环境不存在相关的库文件,因此bash不能运行, 从而报上述错误,解决方法是利用 ldd /bin/bash 查找到其所需要的运行库:raotl ocal host # 1 dd /bi n/bash1i nux-vdso.so.L =(0x0000?fff9abbb000)libtinfa. so. 5 = /11 b64/11 btl rrfo. so. 5 (Dk0000003210000000 Hbdl. sa. 2 =a /

11、1164/111x11.50.2 (OxOOOOOD320e8COOOO) libc.so.6 = /libe斗 1/Hbe. so. d (oxoooooozoecooooo) /1-i b64/ld-l-i nuK-x86-C4. so. 2 (0x00c000320e400000)raot1ocalhost 样 forOx |grep /|xargs Is -11rwMThHrwK. 1 raot rootIrwx疋.1 ocyt rootIrwxrxwk. 1 root root1213Sep 165ep 16/bi n/bash;do echo 5i;done |grep -v =

12、|grep05 : 0& /H b64/ld-l 1 mux-M86-64 . so. 2 - 1 d-2.1205 :/HbGi/libc.so.6 - 11 bc-2.12. so05:09 /li b64/libdl.sc.2 - 11bdl -2.12. so 05:09 /ibG/libtirrFG so. 5 -a libtirrh然后将其拷贝至 到/home/longlin/chroot/lib64 下面:rocrt&local host chroot# mkdi r 1i b64root!ocalhost chrootj# cp -av /Idb64/ld-11nux-x86-

13、64.so.2,1d-2.12.so?libe.s . 6,ll bc-2.12. so, li bdl. so. 2,libdl -2.12. so, libfi nf. so. 5,11btinfo.so. 5.7 /home/l onglln/chroot/li b64/ /Ti b64/l d-linux-x86-64. so. 2 - /home/longl_i n/chroot/1 i be/ld-H nux-x86-64. so. /lib6斗/Id-E. HE. so - /home/longH n/chroot/H b64/l d-2.12. so/lib64/libc. s

14、o. 61 - /home/lonqlin/chroot/lib64/l_i be.so.61/lib64/libc-2.12. so - /honie/Tonqlln/chroot/11 b64/libc-2.12. so /li b64-/libcn . so. 2 - /home/lonqli n/choot/Ii bGd/l V bcH 一 灯O-2 /Iib64/libdl-2.12.so - /hane/lcnglln/chroot/1 ib64/liWl-2.12.so/lib64/libfi rrfo. so. 5 /hane/lcngll n/chrcat/1 lb64/11

15、 bfi nfo. so. 5、/l i b 石 4/l ibti rrfo. 20. 5.7 -a /homE/lo门qlii bti 门 fo. eq. 5.7rooti&locAI host chroot# ch root /home/1 ongl i n /chr oot / basli-4.1 # pwd成功了,后续可以加入比如Is或者是touch等命令,写一个脚本吧!# ! /bi n/basM* 找出一*砧令旳动髙谨摂阵k 林.高将孩fifi:至口我爵第.九旳 目灵下面; 它就会自 M#屈卫命令自勺自灯.匪支件加至U屈至自灯乂枠力下国#U5AGE=#;mkdi r /ln-ome

16、/1 ongl i n/ #cd /home/longl 1 ng #mkdi r chro-ox#cp-v /bi hi/bashchroot/bi n/# /erea-te_I b wIh chroot/申上面主垂是作用是将FbU rVbmmln的鈕夸复宙if至yiFhciinE/1oinig11匚hr oaT/bi n- T 滔吉速过择行卿龙w 将7 b P Hi/bas h禅卞泄护耳至即自勺云甘盈立枠宜.呦ll至H/kioiTi皀/llQripl -in/匚hr乜乜亡下面. 追.样壯戈后可Gd隹用i chroot/bin/lsrootloral host longlin# cp -av

17、 /bin/touch rhroot/bi n/bin/touch - chrciotYbr门/touchrootf&lo cal host longli nJ# . /create_l i b. sh create_li b. sh not a dynamic executableDone!root&localhost longli n# . /create_ 1 b. sh chroot/ |/Tib64/ld-li nux-x86-64. so. 2 / i bti4/i i bad . so. 1 / i b64/li battr. so. 1 /li b64/li bca .so.

18、2 /lib64/li be. so.6 /lib64/libdl. so. 2 /li b64/11 bpthread.so.,0 /li b64/librt. so 1 /I i b64/l -ibselii nux. so. 1 /I i b64/l i bfi nfo .so. 5 stafically linked /li b64/li bad . so. 1 - chroot/l-i b64/l-i bad. so. 1/lib64/libad.so.1.1.O - chroQt/!ib64/libacl.so.1.1.O/lib64/li battr. so. 1 - chroo

19、t/lib64/l ibattr. so.l/Ii b64/li battr.so.1.1.0 - chrcot/!i b64/li battr. so.1.1.0/lib64/li bcap. so. 21 - chroot/l-i b64/l-i bcap. so. 21/li b64/li bcap. so. 2.161 - chroot/! i b64/l-i b:ap. so. 2.16/Iib64/li bpthread, so.O - n chroot/! i b64/libpthread.so.0r/Iib64/libpthread-2.12.so - chroot/Iib64

20、/libpthread-2.12.soVlib&4/librt.so.l - chroot/!1b64/librt.so_1/lib64/librt-2.12.so - chroot/!ib64/librt-2.12.so/li b64/li bselii nux. so. 1 - chroQt/! i b64/libsel i nux. so.l Done!用 grub 来引导GRUB的概述在Red Hat linux装载一个系统前,它必须由一个引导装载程序(boot loader,启动管理程序) 中的特定指令告诉它去引导系统。这个程序一般是位于系统的主硬盘驱动器或是其他知道如 何去开始li

21、nux内核的媒介驱动器上。装载 GRUB 和操作系统的过程,包括以下几个操作步骤:1、装载基本的引导装载程序,这通常是第一步。基本引导装载程序必须是位于主引导 扇区中一个非常小的空间,少于512 字节。因此,基本引导装载程序所做的唯一的事情就是 装载第二引导装载程序。这主要是归结于在主引导扇区中没有足够的空间用于其他东西了。2、装载第二引导装载程序,这通常称为第二步。这第二引导装载程序实际上是引出更 高级的功能,以允许用户装载入一个特定的操作系统。在GRUB中,这步是让用户显示一 个菜单或是输入命令。3、装载在一个特定分区上的操作系统,如linux内核。一旦GRUB从它的命令行或是配 置文件中

22、,接到开始操作系统的正确指令,它就寻找必要的引导文件,然后把机器的控制权 移交给操作系统。基本说明:设备名称系统的第一个硬盘驱动器被GRUB称为(hdO)。在它上面的第一个分区被称为(hdO,O),第二个 硬盘驱动器上的第5个分区被称为(hd1,4)。通常使用GRUB时,文件系统习惯上采用下面的 方式命名:(,),(hd)是指硬盘,(fd)是指软盘。当指定整个硬盘,不考虑它的分区时,简 单地将逗号和分区编号取消即可。当告诉GRUB配置一个特定硬盘的主引导扇区时,这一点 很重要。比如,(hd0)指定第一个设备,(hd3)指定第四个设备。文件名称:当在GRUB中输入包括文件的命令时,比如在多操作系

23、统中使用一个菜单列表,文件名必须 直接在设备和分区后指定。一个绝对文件名的格式如下: (,)/path/to/file。命令的使用:1)进入 GRUB 的命令行模式 grub如果开机时,GRUB出现的是grub,说明你没有/etc/grub/menu.lst,或者说是没有 /boot/grub/grub.conf的一个引导,您需要自己写一个才会GRUB的菜单,让我们来选择进入 哪个系统。如果有GRUB的菜单,您可以按Ctrl+c组合键进入GRUB的命令行模式,会出现 grub 提示符;grub2)用help命令查看,用cat命令查看,cat指令是用来查看文件内容的,有时我们不知道Linux的/

24、boot分区,以及/根分区所在的位 置,要查看/etc/fstab的内容来得知,这时,我们就要用到cat (hd0-n,y)/etc/fstab来获得这 些内容;注意要学会用tab键命令补齐的功能;grub cat ( 按 tab 键会出来 hd0 或 hd1 之类的;grub cat (hdO,注:输入hdO,然后再按tab键;会出来分区之类的;grub cat (hd0,6)具体的案例:1、用命令行来引导Linux操作系统的步骤(grub中没有grub.conf的时候) 通过命令行来引导操作系统的流程,也没有什么难的;无非是把指令手工输入到grub提示 符的后面;在这个过程中,tab键的命

25、令补齐功能就显得很重要了。如果您不知道有哪些命 令,可以输入 help;如果是 grub 下面目录都没有了,那么需要重装 grub 这个启动小程序。 1.安装这里有两种方法:(1)种是直接#grub-install /dev/sda这种就会在/boot/目录下生成/grub文件夹下面的文 件,然后直接配置grub.conf即可。着重说明的是第二种方法:用此方法修复grub是把/boot/grub下的stage镜像安装到硬盘上的特定位置上。所以使用此 法修复grub仅限于是硬盘上的stage1 (在MBR里)以及stage1.5,修复依赖于/boot/grub 下的stage1, stage1.

26、5, stage2镜像。如果这几个镜像也遭到破坏,则此法无效。(如果没有用 第一种方法)(2)第二种就是用命令行引导Linux操作系统了,首先,是在命令行操作(如果已经重启了,就需要进入linux rescue下面),查看磁盘结构, 看 boot 目录在哪一块磁盘上?S11-4 . lit fdisk -1Dish /deu/sda : Z1.5byteslitcidii j G3 iec LuiLs/LraL;kf SIjIQ gljIUr its - cy 1 indcrs of 16065 512 一 8225280 bytessize ( Ingical/plijsinfll ) -

27、51Z bytf=is z hl/: hytfs1/0 size (minimum/optiml) : 5LZ. bytes / 51Z bLites Disk idtnlif ier: 0x00069033Benice BootStartEndE locksIdSystem/deu/sdal *1Z6Z04E06E3LinuxIdi11 i l ic ii 1 dues nu L c nd un llj! indt:ir buundciiLi.261938153E6606E3L inux193821992G97152B2L inuxswap / Solaris# grub/启动 grubPr

28、obing devices to guess BIOS drives. This may take a long time.GNU GRUB version O.97 (64OK lower / 3O72K upper memory) Minimal BASH-like line editing is supported. For the first word, TABlists possible command completions. Anywhere else TAB lists the possible completions of a device/filename.grub roo

29、t (hd0,0) /首先 find /grub/stage1 查看/boot 分区为(hd0,0) root (hd0,0)设置/boot 分区为/dev/sda1Filesystem type is ext2fs, partition type 0x83grub setup (hdO)重新安装 grubsetup (hd0)Checking if /boot/grub/stage1 exists. noChecking if /grub/stage1 exists. yesChecking if /grub/stage2 exists. yesChecking if /grub/e2fs_

30、stage1_5 exists. yesRunning embed /grub/e2fs_stage1_5 (hdO). 26 sectors are embedded.succeededRunning install /grub/stage1 (hdO) (hdO)1+26 p (hdO,O)/grub/stage2 /grub/grub.conf. succeededDone.grub quit/退出2.通过grub命令行直接登录系统(这种是不需要grub.conf文件的)GNU GRUB version B r 97C638K louer 霍 522176K upper Menory)M

31、ini) BASH-1 ike 1 i no ed i t irg is- supported . For t Jib f i rst word ? TAB 1 i sis pci ss ibis cuivMaTid 匚口 nplei i 口 t 石, AnyhiherB曰 TAB 1 i sts t hs puss i b leconple ions oF e devicaf i LenaM曰1Ljrub _查找find /grub/stagel然后找到/boot分区为(hdO,O),指定kernel,initrd,boot启动系统成 功。rub find grub/stagel(hd,2)

32、rub rcGi (hd0. ii)rror 11: Llmre cognised dev icm st ringrub rcGt (hd0,3)F i lessteM tipeext 2f s, part it ion type SxB3rub kernel /um! ii)uz-Zr 6.32-71. el6.16S6 ro roct=/deu/da3 L inux-bz Inag e, setu.p = 0x3400, s ize-Rx37bf 80 rub iniird /in itraMfs-2.6.32-71. e 16. 1636. itigLinux-itiitrd 9xlf2

33、f70BB, BxbeBBce bteslrub bcut3. 启动系统成功之后,进入系统重新写/boot/grub.conf文件。4. 进入 linux rescue 重建一个 grubrfpub? f ind /ryrub/stagelf ind /gfrub/stagfelChdOjB)(hd6.2)grmb root Chd6 j 0)root (hdSj6)Filesystem type Is extZfs. partition type 0x83gpiib) setup ChdBliif if if ifVbootgpLib/sexists no,Vgru.b/3tagcl,F e

34、xists yes/grub/s七exists . yes /grLib/cZfs-stagr l_5,p exists yessectors are embedded feetup UidB)CheckingCheckingCheckingCheckinyRumi Ing ,aemhed /grub/eZf s_stagel_5 thdFi J,p - . BsucceeBdRimn inc R,insta i 1 zgrubzstagel ChdH ) ChdW)l+Z6 p)/grub/stageZ gputb/gruih .Conf- EiLC匚EEdEilDone.5. 最后重新启动

35、成功了。模拟一些常见问题并且修复破坏了 sda的MBR中的引导程序Booting ftom loca 1 disk.NetHork boot froM Intel E1000UMware, Inc.Intel Corporal ionCopyright (C) 2903-2008Copyright (C) 1997-2000PXE-EC8: ?PXE structure Nas not found in UNDI driver code segMent. |PXE-M0F: Exiting In PXE RtJM.直接到了这个界面。解决办法进入BIOS,直接选择光驱启动的方式。虚拟机里面有一个

36、开机直接启动到BIOS的 功能。直接选择救援模式就行了在linux6中有那个救援模式的选项。(然后按照它的提示进行选择)RescueThe rescue environment ui11 nou attempt to find your Linux insta1lation and mount it under the directory /mn七/百百imogE. You can then ma(e any changes required to your system. If you uant to proceed with this step choose J ContinueJ . Y

37、ou can a Iso choose to mount your file systems read-on ly ins七亡of read-wr i七亡 by choosing Read-0nlyf . If you need to act iuate SAM devices choose Advanced.If for some reason this pro匚亡s:w fails you can choose Skip and this step ui11 be skipped and you mill go directly to a command she 11.上图的如果/etc/

38、fstab元整的话,我原来的系统会自动挂载在/mnt/sysimage上面给。如果没 有/etc/fstab就挂载不上。fcash-4.1# fdisk -1Disk zdeu/sda: 21.5 GB 21474836480 bytesE55 hucicls, 63 ucu lurs Lrauk j 2618 uy 1 i iidtrrsUnits = cy1inders of 16665 * 512 = QZZ5280 bytesSector size (logica1/physica 1) : 512 bytes / 51Z bytesTz() 5?i zf (mi ni mumznpt

39、 i ma 1 ) : SI 2 bytes: Z 512 bj+ fs:Disk identifier: BxBBaSffeSDeuice BootStartEndBlocks Id System前面提示我的系统已经挂载到了/mnt/sysimage上,这样我就可以直接使用chroot命令进行 根目录的限制。I 丽 igETIIstt)inf irmuiare1 ilEdrrnitdewin itli曲 oilmodulesetc1 it.lib oldo1 dtmpfcash-l. IBcd mnt/sijsima(ie/ljaeh-4 . litIspindevbumt:1 lb64mu

40、diaThootetcliblest+f oiindntnt. lttchrDot /mnt/sljsprccseii nuxlisproo tSL|Susr_oIdsb intmpvaroptrootsei i mixsys usr yumprocsb i lisrutmp uar通过这个就可以将直接的系统限制在/mnt/sysimage里面了。sli-4.1# grub-insta 11 /deu/sdaI ii Ld 1 let L iuii f i ii ibccl . Nu errjr i-epurlel .Tli i s i s t lie contents of t he deu

41、 i ce map /bootce .map .Clieck if this is correct or not. f any of the 1 ines is incarrect, f ix it and re-run the script grub-instm11.ft tli is device map uas generated by anaconda(lidO)/deu/sda查看它的磁盘的结构:sli-4.1# grub-insta 11 /deu/sda111 La 1 la L iuii f i n ibtd . Nu errjr i-epurlel .Tli i s i s

42、t lie contents of t he deu i ce map /boot/grubdeyi ce .map . Clieck if this is correct or nat. f any of the 1 ines is incorrect, f ix it and re-run the script Lgrub-insta11f .ft tli is device map uas generated by anaconla(lidO)zdeu/sdft接下来就是直接进行修复了。然后按住exit再按exit,就到了下面的界面里面去了。I nk I評5f包含lmg分rooWserv

43、e rm: camnot r rootserve TOoWserve ootserver TO observe ;rootserver ootserve ;ra observe root(&servere # emove# 井# 井#直接重启,破坏几个重要的文件:1)人为的删除系统关键文件rm -rf /boot/boot: Device or resource busy umount /boot/ rm -rf /boot/rm -rf /etc/rc.d/rc.sysinitrm -rf /er匚日/10日1rm -rf et匸门门ittalbmv /etc/fstab /etc/f st

44、ab, balesync 将缰冲去內咨写入磁盘2)修复 linux 系统1.进入修复模式我是用Iinux6的系统做的,然后是虚拟机的话直接可以进入到BIOS里面,然后改变启动方 式,使得光驱优先启动。Ue1come to Red Hat Enterprise Linux 6.2!Instal 1 or upgrade an elst iig sstem Instal1 system uith basic uideo driuer ijescue installed systemBoot from lo匚a.1 driueMemory test如果是RHEL5光盘的话,输入linux rescu

45、re或者是F5进入rescur修复模式接下来是选择English -usLocal CD/DVD, Setup Networking的时候选择No1 f you wan-tCoTi-fc 1 Ti IJ 已LJOIU Fi H e ol. E3cn w 1 r- onmcn-t1 n 3= t 1 1 1 曰_*t i il=H n mn qu 1p ar* o e: as h d.lji 1 .111 宅 匸七巴口cetn 1 sorSk 1k1上图因为是没有了/etc/fstab所以是不能将系统挂载到/mnt/sysimage中。其中最重要的是 /boot 目录的挂载情况了。binf i

46、rmwarelib64mntprocse 1 i tilixusrdevin itlib64_oldmodulesrootsysLisr_olde+rlib1 ib_nTdoIdtmpsb intmpwarR)ash-4.1# Is”msh-理ill 匚21abc 1bash-4.1# eZlabe1badblocks basename bmshb indb i osdevname blkidbrcm_iscs iuio breiak btrfs匚kbuilt in buns ipE bzcatttash-4.1# Is /mint/sysimage/ 挂载不成功,下面没有东西feash-4.

47、1# chroot /mnt/sysimage/chroot: failed to run command zbin/shf- Hu such file or directory fcash-4.1#2还原fstab文件。根据上面步骤得知rescue程序无法找到硬盘分区,所以现在要做的事情就是恢复linux分区也就是fstab文件(这个fstab文件在删除之前,有做过备份/etc/fstab.bak)。#fdisk -l查看磁盘分区bash-4.1ft fdisk -1IzO s ize Cminimumi/apt ima 1 );512 bytes/ 51Z bytesDisk ideifi

48、tif ier :0x0005ffe5Devi匚巴B 口口七StartEndB1口匸k百Id古七亡mzdie vy s:d a 112204BGB83L i nuxPort it inn1 dotesnot end oncylinderboundary HZflcw/xdttZZ6193615360066B3Linuxzdcv/sdft319362199209715282Linuxsmap z Solaris21.5 GB, Z147483B4B0 bytes2610 cy1indens:=6225280 bytes51Z bytes z 512 bytesDik /deu/sda:Z55 i

49、eads 63 secUnits = cylinders of 15B65 * 51Z SectorC log ica.lzphys ica 1):图所示的磁盘结构,就是我原来要修复的系统的磁盘的结构。1_ Ud-/dev/sdci 1REELS里面是看卷标,/dey/stla 艺feash-4.1# bpgbash-4.lttblockdeu blkidLdcvsdaS :UJID-fcGSaEc cf5B 4c?6-B0c9 9369d95&clcbTVPE = ,Swapubtrf set 1bz ipZ也是社RHELB里面看的是UUIB7-pdeu/loop9: TYPE=squash

50、fsuprlRuzsdfll : Illi Tn=,a44Eb1F7-222d-4fl4R- net/sillh821025由上图可得知/dev/sda1是/boot分区,而/dev/sda2无法查看,因为sda2是LVM分区。 使用命令激活 LVM 分区 #lvmvgchange -ay 这个命令的作用就是告诉系统建立相关的 device-mapper , 这 样 就 可 以 看 到 /dev 下 建 立 了 /dev/mapper/VGname-LVname 和 /dev/VGname/LVname的设备文件和链接文件。s!:h-3.2# Ium /ugchange -ay2 lijg i

51、ca 1 ud 1 ume(s ) in volume group UoIGroup09 now 录匚t ivesh-3.2#sh-3.2#sh-3 .24(sh-3 .24( Is zdev/mapper/MolGrtiupS-LogUo 130k)i-3 .ZUuoiGroupeB-LogUoiiaitpqiiurpjg. csdn. net/smh821025使 用 ls/dev/mapper 命 令 可 以 看 到 VolGroup00-LogVol00 ( 就 是 / 根 分 区 ) 和VolGroup00-LogVol01(就是 swap 分区)接下来,要挂载/根分区了,并恢复fs

52、tab文件。#mkdir longlin -建立一个空目录用来挂载分区矗口3:1一吒 1井 mkd ir long 1 i nz卜n皂1一41井 mount zdevzsda2 long 1 inz卜ah-4ltt Is z long 1 in 1 inIs: cannot access Z1ong 1 inz 1 in : No such bash-4 a lit Is z long 1 inzbinetc1 i b1 ost+ f oundruntprocflevhome1 ib6-lmediaoptroot卜cp -a /long 1i n/etc/f stab bkfeasJi-4 i

53、nfile or d irectorysb insrw tmpse1inux sys usr /long 1in/etc/f stabwaryum上面要说的是,将根目录挂载之后呢,可以恢复的,应为/etc/fstab就在/目录下面,如果没 有备份的话,就直接创建一个,根据其它机器的参考。#reboot 重启系统。3.修复内核和 grub重启之后,进入修复模式,这个时候修复模式下会找到fstab文件,也就是找到linux分区了,这个时候损坏的linux系统挂载到/mnt/sysimage下。|Rescue |二YuurB system hci:s been mo Linked under zmn

54、tzsys i mage _Press t o g(e a she 1 1 If 耳口 uujciu 1 d 1 i kt: to ma kt: your syi廿Lum 七huLCi口 1: enui ronmen t , nun t he cnmm a lid :口/mntZsys imageThe system ul 1 1 r-eboot aiitoma i c:a 1 ly uhen you exit f r om the she 11 上面提示,挂载系统成功,可以使用#chroot /mnt/sysimage修改根目录了)。basii-4 . in is /mnt/sysimage

55、/bindeuheme1ibfc4mediaaptrootse1inuxsysusryumbootetcliblost+fourdmntprocsb insrutmpuarbasli-1.1# chroot /mnt/sysimage/_ I# cxi texit看上面各种命令导致shell的变化。#exit 退回到 rescue 模式下。一般把处于resuce模式的系统称为伪系统,把#chroot/mnt/sysimage后看到的称为真正的系 统。、接下进入到#chroot /mnt/sysimage下面,用yum安装内核,长生 先使用#yum remove kernel移除,然后再重新装载

56、。initramf s-2 . & . 32-220 . el6 .sh-4.1# Is /boot/System.map-Z.6.3Z-ZZB.e1G.x86_64symuers-Z.6.3Z-ZZB.el6.x86_G4.gzcnnfig-2 B 32-2?H.elB xHB_h4um i rii7-Z . 6.32-22R . el K . xRB_B4ir itramfs-2.6.3Z-ZZ0.e16.xB6_64.img内核安装成功了,然后 是安装/dev/sdamsh-4.1# chroot /rnnt/sys image/Eh-4.1# g(rub- insta 11 /deu/sdaProbing devices to guess BIOS driues. Th is may take a long time, nsta 1 lat ior f inislied . No error reported .This is th亡 conttntw of the device map zboot/grub/device.map. Checlt if this is correct or mot. IF any of the lines is incorrect fix it and re-

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!