加入收藏 | 设为首页 | 会员中心 | 我要投稿 应用网_丽江站长网 (http://www.0888zz.com/)- 科技、建站、数据工具、云上网络、机器学习!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

centos 6如何恢复被删除了的boot分区

发布时间:2016-05-27 02:55:43 所属栏目:Linux 来源:网络整理
导读:Centos6系统/boot分区被删除了,但是又不想重新安装系统,下面介绍一种快速的方法恢复boot分区。 1.首先利用centos6镜像进入linux rescue救援模式。 2.启动sshd

[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: 0x000b1db4

Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          13      102400   83  Linux//这个为/boot启动分区

Partition 1 does not end on cylinder boundary.

/dev/sda2              13         144     1048576   82  Linux swap / Solaris

Partition 2 does not end on cylinder boundary.

/dev/sda3             144        2611    19819520   83  Linux //这个为/根分区

[root@localhost /]# mount//查看所有挂载分区

/dev/sda3 on / type ext4 (rw)//根分区

/dev/sda1 on /boot type ext4 (rw)//boot分区为sda1

devpts on /dev/pts type devpts (rw)

tmpfs on /dev/shm type tmpfs (rw)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

/dev/sr0 on /mnt type iso9660 (ro)

[root@localhost /]# grub//启动grub

Probing devices to guess BIOS drives. This may take a long time.

GNU GRUB  version 0.97  (640K lower / 3072K upper memory)

[ Minimal BASH-like line editing is supported.  For the first word, TAB

lists possible command completions.  Anywhere else TAB lists the possible

completions of a device/filename.]

grub> root (hd0,0) //首先find /grub/stage1查看/boot分区为(hd0,0)

root (hd0,0)//设置/boot分区为/dev/sda1

Filesystem type is ext2fs, partition type 0x83

grub> setup (hd0)//重新安装grub

setup (hd0)

Checking if "/boot/grub/stage1" exists... no

Checking if "/grub/stage1" exists... yes

Checking if "/grub/stage2" exists... yes

Checking if "/grub/e2fs_stage1_5" exists... yes

Running "embed /grub/e2fs_stage1_5 (hd0)"...  26 sectors are embedded.

succeeded

Running "install /grub/stage1 (hd0) (hd0)1+26 p (hd0,0)/grub/stage2 /grub/grub.conf"... succeeded

Done.

grub> quit//退出

(编辑:应用网_丽江站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读