CentOS 6删除的boot分区怎样复原

相关游戏 相关文章 发表评论字体大小:【 | |

作者:佚名 2020-01-03 来源:本站整理    浏览:5     评论:0 条

  正在CentOS 6体系外,果为没有小口或操做得误招致boot分区被增除了,逢到那种状况能否可以规复被增除了的boot分区呢?其真是能够的,上面随小编一同去理解高吧。

  1.尾先操纵centos6镜像入进linux rescue营救形式。

CentOS 6删除的boot分区怎样复原

  2.封动sshd效劳,查看eth0获与的ip天址,而后用ssh secure shell 连贯。

  SSH Secure Shell 3.2.9 (Build 283)

  Copyright (c) 2000-2003 SSH Co妹妹unications Security Corp - http://www.ssh.com/

  This copy of SSH Secure Shell is a non-co妹妹ercial version.

  This version does not include PKI and PKCS #11 functionality.

  [root@localhost ~]# cd /boot //入进/boot分区

  [root@localhost boot]# ls //查看boot分区的内容

  config-2.6.32-71.el6.i686 symvers-2.6.32-71.el6.i686.gz

  grub System.map-2.6.32-71.el6.i686

  initramfs-2.6.32-71.el6.i686.img vmlinuz-2.6.32-71.el6.i686

  [root@localhost boot]# cd 。。//返回上层目次

  [root@localhost /]# rm -rf /boot/*//增除了/boot分区一切内容

  [root@localhost /]# ls /boot//查看/boot分区内容为空

  [root@localhost /]# mount /dev/sr0 /mnt//挂载cdrom设施到/mnt目次高

  mount: block device /dev/sr0 is write-protected, mounting read-only

  [root@localhost /]# rpm -ivh /mnt/Packages/kernel-2.6.32-71.el6.i686.rpm --root=/ --force //装置光盘的kernel硬件包

  Preparing.。。 ########################################### [100%]

  1:kernel ########################################### [100%]

  [root@localhost /]# ls /boot //查看/boot分区内容

  config-2.6.32-71.el6.i686 System.map-2.6.32-71.el6.i686

  initramfs-2.6.32-71.el6.i686.img vmlinuz-2.6.32-71.el6.i686

  symvers-2.6.32-71.el6.i686.gz

  [root@localhost /]# mkdir /boot/grub//正在/boot目次新修一个grub目次

  [root@localhost /]# touch /boot/grub/grub.conf//新修一个grub.conf设置文件

  [root@localhost /]# cp -rf /usr/share/grub/i386-pc/* /boot/grub/ //把/usr/share/grub/i386-pc的一切内容拷贝到/boot/grub外。

  [root@localhost /]# ls /boot//查看/boot分区内容

  config-2.6.32-71.el6.i686 symvers-2.6.32-71.el6.i686.gz

  grub System.map-2.6.32-71.el6.i686

  initramfs-2.6.32-71.el6.i686.img vmlinuz-2.6.32-71.el6.i686

  [root@localhost /]# ls /boot/grub/ //查看/boot/grub目次内容

  e2fs_stage1_5 iso9660_stage1_5 stage1 vstafs_stage1_5

  fat_stage1_5 jfs_stage1_5 stage2 xfs_stage1_5

  ffs_stage1_5 minix_stage1_5 stage2_eltorito

  grub.conf reiserfs_stage1_5 ufs2_stage1_5

  [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 co妹妹and 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//退没

这些是你想要的吗?

相关游戏

网友评论

评论需审核后才能显示