windows7mbr修复-(win10mbr修复)

路由设置 次浏览手机阅读
windows7mbr修复 (win10mbr修复)

.什么是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挂载,如果大于2T使用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-4ecd-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/ext3文件系统的文件系统参数,Windows下面如果出现意外断电死机情况,下次卡机一般都会出现系统自检。Linux系统下面也有文件系统自检,而且是可以通过tune2fs命令,自定义自检周期及方式

现在我们在模拟一下,将硬盘用parted分区

电脑

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

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

GNU Parted 2.1

Using /dev/sdb

Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) help

align-check TYPE N check partition N for TYPE(min|opt) alignment

check NUMBER do a simple check on the file system

cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER copy file system to another partition

help [COMMAND] print general help, or help on COMMAND

mklabel,mktable LABEL-TYPE create a new disklabel (partition table)

mkfs NUMBER FS-TYPE make a FS-TYPE file system on partition 电脑 NUMBER

mkpart PART-TYPE [FS-TYPE] START END make a partition

mkpartfs PART-TYPE FS-TYPE START END make a partition with a file system

move NUMBER START END move partition NUMBER

name NUMBER NAME name partition NUMBER as NAME

print [devices|free|list,all|NUMBER] display the partition table, available devices, free space, all found partitions, or a

particular partition

quit exit program

rescue START END rescue a lost partition near START and END

resize NUMBER START END resize partition NUMBER and its file system

rm NUMBER delete partition NUMBER

select DEVICE choose the device to edit

set NUMBER FLAG STATE change the FLAG on partition NUMBER

toggle [NUMBER [FLAG]] toggle the state of FLAG on partition NUMBER

unit UNIT set the default unit to UNIT

version display the version number and copyright information of GNU Parted

(parted) mklabel gpt

Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?

Yes/No? y

(parted) p

Model: VMware, VMware Virtual S (scsi)

Disk /dev/sdb: 107MB

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

Partition Table: gpt

Number Start End Size File system Name Flags

(parted) mkpart primary 0 30

Warning: The resulting partition is not properly aligned for best performance.

Ignore/Cancel? I

(parted) p

Model: VMware, VMware Virtual S (scsi)

Disk /dev/sdb: 107MB

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

Partition Table: gpt

Number Start End Size File system Name Flags

1 17.4kB 30.0MB 30.0MB primary

(parted) mkpart logical 30 106

(parted) p

Model: VMware, VMware Virtual S (scsi)

Disk /dev/sdb: 107MB

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

Partition Table: gpt

Number Start End Size File system Name Flags

1 17.4kB 30.0MB 30.0MB primary

2 30.4MB 106MB 75.5MB logical

(parted) q

此时需要将新建分区写入内核 partprobe /dev/sdb

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

[root@GW ~]# parted /dev/sdb p

Model: VMware, VMware Virtual S (scsi)

Disk /dev/sdb: 107MB

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

Partition Table: gpt

Number Start End Size File system Name Flags

1 17.4kB 30.0MB 30.0MB primary

2 30.4MB 106MB 75.5MB logical

[root@GW ~]# mkfs.ext4 /dev/sda1

mke2fs 1.41.12 (17-May-2010)

/dev/sda1 is mounted; will not make a filesystem here!

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

mke2fs 1.41.12 (17-May-2010)

Filesystem label=

OS type: Linux

Block size=1024 (log=0)

Fragment size=1024 (log=0)

Stride=0 blocks, Stripe width=0 blocks

7328 inodes, 29280 blocks

1464 blocks (5.00%) reserved for the super user

First data block=1

Maximum filesystem blocks=30146560

4 block groups

8192 blocks per group, 8192 fragments per group

1832 inodes per group

Superblock backups stored on blocks:

8193, 24577

Writing inode tables: done

Creating journal (1024 blocks): done

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 24 mounts or

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

[root@GW ~]# mkfs.ext4 /dev/sdb2

mke2fs 1.41.12 (17-May-2010)

Filesystem label=

OS type: Linux

Block size=1024 (log=0)

Fragment size=1024 (log=0)

Stride=0 blocks, Stripe width=0 blocks

18432 inodes, 73728 blocks

3686 blocks (5.00%) reserved for the super user

First data block=1

Maximum filesystem blocks=67371008

9 block groups

8192 blocks per group, 8192 fragments per group

2048 inodes per group

Superblock backups stored on blocks:

8193, 24577, 40961, 57345

Writing inode tables: done

Creating journal (4096 blocks): done

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 32 mounts or

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

最后一行出现了tune2fs -c or -i to override,这个是linux文件系统询问自检的,需要设置tune2fs -c -1 /dev/sdb1 ;tune2fs -c -1 /dev/sdb2这样就不会出现巡检文件系统了


电脑
喜欢 ()