修复linux mbr,linux修复MBR扇区故障解决方案

故障原因病毒、木马等造成的破坏(如硬盘炸弹)

不正确的分区操作、磁盘读写误操作

故障现象找不到引导程序,启动中断

无法加载操作系统,开机后黑屏

解决思路应提前作好备份文件

以安装光盘引导进入急救模式

从备份文件中恢复

修复MBR扇区故障示例:

第一步:添加一块20G硬盘

[root@localhost ~]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x000eac35

Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          26      204800   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2              26        1046     8192000   82  Linux swap / Solaris

/dev/sda3            1046        2611    12573696   83  Linux

Disk /dev/sdb: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

第二步硬盘分区

[root@localhost ~]# fdisk /dev/sdb

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel with disk identifier 0x52d92de3.

Changes will remain in memory only, until you decide to write them.

After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to

switch off the mode (command 'c') and change display units to

sectors (command 'u').

Command (m for help): n

Command action

e   extended

p   primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-2610, default 1):

Using default value 1

Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610):

Using default value 2610

Command (m for help): p

Disk /dev/sdb: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x52d92de3

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1        2610    20964793+  83  Linux

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

第三步;创建挂载点和格式化

挂载/dev/sdb1 到 /backup,将MBR扇区备份至此,损坏MBR扇区,重启。

[root@localhost ~]# mkdir /shiyan

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

mke2fs 1.41.12 (17-May-2010)

文件系统标签=

操作系统:Linux

块大小=4096 (log=2)

分块大小=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

1310720 inodes, 5241198 blocks

262059 blocks (5.00%) reserved for the super user

第一个数据块=0

Maximum filesystem blocks=4294967296

160 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

4096000

正在写入inode表: 完成

Writing superblocks and filesystem accounting information: 完成

This filesystem will be automatically checked every 25 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

第四步:挂载硬盘和MBR扇区备份

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

[root@localhost ~]# dd if=/dev/sda of=/shiyan/sda.mbr bs=512 count=1记录了1+0 的读入

记录了1+0 的写出

512字节(512 B)已复制,0.0246777 秒,20.7 kB/秒

第五步;破坏系统硬盘扇区和恢复系统

[root@localhost ~]# ls /shiyan/  #查看备份是否成功

lost+found  sda.mbr

[root@localhost ~]# dd if=/dev/zero of=/dev/sda bs=512 count=1   #已经破坏/dev/sda系统盘

记录了1+0 的读入

记录了1+0 的写出

512字节(512 B)已复制,0.000240867 秒,2.1 MB/秒

来测试以下是否成功破坏

[root@localhost ~]# reboot  #重启以下系统

如执行结果以下图片结果一样说明:系统盘已经丢失文件需要修复才可以进入系统

修复linux mbr,linux修复MBR扇区故障解决方案_第1张图片

MBR扇区故障

请插入安装程序光盘到服务器里或者使用外部光驱启动,从光盘引导进入安全模式。

选择第三项“Rescue installed systen”

修复linux mbr,linux修复MBR扇区故障解决方案_第2张图片

引导程序菜单

选择语言:默认英语   点击:OK

修复linux mbr,linux修复MBR扇区故障解决方案_第3张图片

引导程序选择语言

选择键盘;美式键盘 点击:OK

修复linux mbr,linux修复MBR扇区故障解决方案_第4张图片

选择键盘

是否开启网络访问:选择NO

修复linux mbr,linux修复MBR扇区故障解决方案_第5张图片

是否开启网络访问

选择:Continue

修复linux mbr,linux修复MBR扇区故障解决方案_第6张图片

引导程序菜单里面选项

选择:OK

修复linux mbr,linux修复MBR扇区故障解决方案_第7张图片

选项OK

选择shell

修复linux mbr,linux修复MBR扇区故障解决方案_第8张图片

shell选项界面

在shell界面将/dev/sdb1挂载使用,将里面的备份写入/dev/sda,重启

修复linux mbr,linux修复MBR扇区故障解决方案_第9张图片

创建目录挂载备份

重启进入系统,MBR分区修复成功。

进入系统说明已经成功恢复

修复linux mbr,linux修复MBR扇区故障解决方案_第10张图片

系统启动自检界面

你可能感兴趣的:(修复linux,mbr)