u盘mbr备份恢复 (U盘备份恢复)

.什么是MBR,MBR如何恢复损坏?

linux主机启动启动,将加载MBR启动引导程序,MBR硬盘0磁道0柱面1扇区前446字节存储在启动引导程序中,1扇区后64字节存储分区表,后面有两个字节,分区表的结尾标志符55AA

1)模拟MBR损坏引导程序:删除MBR引导程序文件

[root@lixiang grub]# rm grub.conf

rm: remove regular file `grub.conf'? y

2)重启系统reboot,这时,我们看到下面的图片出现在系统中

3)首先可以用find (hd0,0)/后接tab按键

4)输入root (hd0,0),出现下图:

5)输入kernel /vmlinuz-2.6.32-504.el6.x86_64 ro root=/dev/sda1 rhgb quiet,或者输入kernel /vmlinuz-2.6.32-504.el6.x86_64 ro root=LABEL=/ rhgb quiet (本法通用)【 注意我的是Centos6.6版本,你可以从其他地方复制,在这个地方/boot/grub/grub.conf,我先记录了这个内容。 ro root=UUID=2acb0807-4ecd-4305-a2e9-28446b3d85ca rd_NO_LUKS rd_NO_LVM.UTF-8;但是忘记也没关系。我会交另一种恢复的方法



6)输入initrd /initramfs-2.6.32-504.el6.x86_64.img

7)最后一步boot重启,当下面的奇迹发生时,系统将成功启动。但只是这次成功登录,下次登录还是会出现这个问题,所以我会备份的grub.conf.bak更改为grub.conf

MBR恢复方法二:

具体恢复方法如下:

1)选择加载光盘启动启动启动,选择救援模式

2)选择默认

3)选择OK

4)网络选择NO

5)选择continue

6)默认ok

7)选择shell Start shell,选择Ok

8)执行命令chroot /mnt/sysimage

9)下面执行mv /boot/grub/grub.conf.bak /boot/grub/grub.conf

10)设置本地硬盘启动,重新启动系统即可。

6.如果磁盘容量小于2T可以使用fdisk如果大于2,挂载T使用parted挂载

1)让我们做一下,比如/dev/sdb磁盘分为两个区域,1P 1L


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

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): m

Command action

a toggle a bootable flag

b edit bsd disklabel

c toggle the dos compatibility flag

d delete a partition

l list known partition types

m print this menu

n add a new partition

o create a new empty DOS partition table

p print the partition table

q quit without saving changes

s create a new empty Sun disklabel

t change a partition's system id

u change display/entry units

v verify the partition table

w write table to disk and exit

x extra functionality (experts only)

Command (m for help): n

Command action

e extended

p primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-102, default 1):

Using default value 1

Last cylinder, cylinders or size{K,M,G}(1-102, default 102): 20MB

Command (m for help): n

Command action

e extended

p primary partition (1-4)

e

Partition number (1-4): 2

First cylinder (21-102, default 21):

Using default value 21

Last cylinder, cylinders or size{K,M,G}(21-102, default 102):

Using default value 102

Command (m for help): p

Disk /dev/sdb: 106 MB, 106954752 bytes

64 heads, 32 sectors/track, 102 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

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

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

Disk identifier: 0x000602e5

Device Boot Start End Blocks Id System

/dev/sdb1 1 20 20464 83 Linux

/dev/sdb2 21 102 83968 5 Extended

Command (m for help): n

Command action

l logical (5 or 电脑 over)

p primary partition (1-4)

l

First cylinder (21-102, default 21):

Using default value 21

Last cylinder, cylinders or size{K,M,G}(21-102, default 102):

Using default value 102

Command (m for help): p

Disk /dev/sdb: 106 MB, 106954752 bytes

64 heads, 32 sectors/track, 102 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

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

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

Disk identifier: 0x000602e5

Device Boot Start End Blocks Id System

/dev/sdb1 1 20 20464 83 Linux

/dev/sdb2 21 102 83968 5 Extended

/dev/sdb5 21 102 83952 83 Linux

分区完成后,我们可以用mkfs -t ext4 格式化分区

[root@GW ~]# mkfs -t ext4 /dev/sdb1

挂载分区,将sdb1挂载到/tmp目录下

[root@GW ~]# mount /dev/sdb1 /tmp

将文件挂载文件写入启动自启动

UUID=2acb0807-4电脑ecd-4305-a2e9-28446b3d85ca / ext4 defaults 1 1

UUID=edab26eb-e5da-47e2-914b-40f4bdf8347d /boot ext4 defaults 1 2

UUID=ff7ab69d-bdc2-40cd-816f-8c30a3e76737 swap swap defaults 0 0

tmpfs /dev/shm tmpfs defaults 0 0

devpts /dev/pts devpts gid=5,mode=620 0 0

sysfs /sys sysfs defaults 0 0

proc /proc proc defaults 0 0

/dev/sdb1 /tmp ext4 defaults 0 0

~

"/etc/fstab" 16L, 841C written


[root@GW ~]# mount -a #检查挂载是否有问题


[root@GW ~]# tune2fs -c -1 /dev/sdb1

tune2fs是调整和检查ext2/ext文件系统参数3,Windows如果下面发生意外断电死机,系统自检通常发生在下一次卡机中。Linux系统下还有文件系统自检,可以通过tune2fs自定义自检周期和方法

现在我们正在模拟硬盘parted分区

电脑

1

{x