Chinaunix首页 | 论坛 | 博客
  • 博客访问: 38427
  • 博文数量: 21
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 282
  • 用 户 组: 普通用户
  • 注册时间: 2014-01-27 16:04
文章分类
文章存档

2014年(21)

我的朋友

分类: LINUX

2014-03-01 11:27:10



模拟MBR主引导扇区损坏:

[root@localhost ~]# dd if=/dev/sda of=/dev/sdb1bs=512 count=1 用DD备份MBR到第二块硬盘的第一个分区(确保/devsdb1分区并格式化完成)

[root@localhost ~]# dd if=/dev/zeroof=/dev/sda bs=512 count=1破坏MBR

[root@localhost ~]# reboot重启并进到光盘引导救援模式

[root@localhost ~]# boot : linux rescue提示boot_:(输入linuxrescue)

[root@localhost ~]# mkdir /data 在救援模式下建立目录/data

[root@localhost ~]# mount /dev/sdb1 /data把备份分区挂载到临时目录

[root@localhost ~]# ls /data

[root@localhost ~]# dd if=/data of=/dev/sdabs=512 count =1

[root@localhost ~]# reboot

二修复grub.conf配置文件

进入救援模式:输入临时引导命令

root (hd0,0)

kernel /vmlinuz-2.6.18-348.el5 roroot=/dev/sda2

initrd /initrd-2.6.18.348-el5.img

boot

建立并编辑grub.conf文件

[root@localhost ~]# vim/boot/grub/grub.conf

default=0

timeout=5

title Red Hat Enterprise Linux

root (hd0,0)

kernel /vmlinuz-2.6.18-348.el5 ro root=LABEL=/ rhgb quiet

initrd /initrd-2.6.18-348.el5.img

三损坏/grub目录,安装/grub目录

[root@localhost ~]# grub-install /dev/sda

在编辑配置文件:

[root@localhost ~]# vim/boot/grub/grub.conf

default=0

timeout=5

title Red Hat Enterprise Linux

root (hd0,0)

kernel /vmlinuz-2.6.18-348.el5 ro root=LABEL=/ rhgb quiet

initrd /initrd-2.6.18-348.el5.img



没有/boot分区:先挂载光盘,找到安装内核软件包,安装内核;

安装grub目录:[root@localhost cd]# grub-install /dev/sda

GRUB目录中没有grub.conf配置文件,[root@localhostgrub]# vim grub.conf

default=0

timeout=5

title Red Hat Linux

root (hd0,0)

kernel /vmlinuz-2.6.18-348.el5 ro root=LABEL=/ rhgb quiet

initrd /initrd-2.6.18-348.el5.img



损坏超级块,修复

破坏/dev/sdb1

[root@localhost ~]# dd if=/dev/zeroof=/dev/sdb1 bs=512 count=4

[root@localhost ~]# umount /dev/sdb1

[root@localhost ~]# mount /dev/sdb1 /home/挂载提示失败

[root@localhost ~]# fsck -y -t ext3/dev/sdb1修复/dev/sdb1(因数据不完整,可能只修复了部分文件)

[root@localhost ~]# fsck -y -t ext3/dev/sdb1根据实际情况,需要多执行几次修复,直到出现clean为止(表示修复完整)

[root@localhost ~]# mount /dev/sdb1 /home/

[root@localhost ~]#
阅读(676) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~