微软官方MSDN原版Win10系统下载

现在位置: 首页  > 系统教程  > Linux教程

CentOS 6删除的boot分区如何还原

时间:2024-05-06 10:33:29   

大家好,今天Win10系统之家小编给大家分享「CentOS 6删除的boot分区如何还原」的知识,如果能碰巧解决你现在面临的问题,记得收藏本站或分享给你的好友们哟~,现在开始吧!

人体是如何运作的?系列软件最新版本下载

  在CentOS 6系统中,因为不小心或操作失误导致boot分区被删除,遇到这种情况是否能够恢复被删除的boot分区呢?其实是可以的,下面随小编一起来了解下吧。

  1.首先利用centos6镜像进入linux rescue救援模式。

  2.启动sshd服务,查看eth0获取的ip地址,然后用ssh secure shell 连接。

  SSH Secure Shell 3.2.9 (Build 283)

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

  This copy of SSH Secure Shell is a non-commercial 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 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//退出

上一页12下一页 剩下全文

以上就是关于「CentOS 6删除的boot分区如何还原」的全部内容,本文讲解到这里啦,希望对大家有所帮助。如果你还想了解更多这方面的信息,记得收藏关注本站~

【此文★为Win10系统之家Www.gHoSt580.net★文章,转载请注明出处!】

相关文章

  • CentOS 6删除的boot分区如何还原

    CentOS 6删除的boot分区如何还原


      在CentOS6系统中,因为不小心或操作失误导致boot分区被删除,遇到这种情况是否能够恢复被删除的boot分区呢?其实是可以的,下面随小编一起来了解下吧。
      1.首先利用centos6镜像进入linuxrescue救援模式。
      2.启动sshd服务,查看eth0获取的ip地址,然后用sshsecureshell连接。
      SSHSecureShell3....
  • 如何解决Linux系统文件已删除但空间未释放的情况

    如何解决Linux系统文件已删除但空间未释放的情况


      当你在进行Linux系统操作的时候,有时会遇到文件被删除但空间未被释放的问题,那么是什么原因导致的呢?又该如何解决,下面小编就给大家介绍下文件被删除但空间未被释放的解决方法。
      1、错误现象
      运维的监控系统发来通知,报告一台服务器空间满了,登陆服务器查看,根分区确实没有空间了,如下图所示:
      这里首先说明一下服务器的一些删除策略,由于Linux没有回收...
  • Linux如何删除swap里的指定文件

    Linux如何删除swap里的指定文件


      Linux系统操作中,因为某些原因而需要删除swap中的某个文件,那么要如何处理呢?其实删除swap内的文件很简单,下面小编就给大家介绍下Linux下如何删除swap里的某个文件。
      方法很简单,按下面的操作就可以了
      vi打开一个文件的时候突然断网,再次连接上去vi打开的时候提示在swap里面已经存在一个。要删除这个文件怎么办呢?
      如下:
     ...
  • Linux如何创建和删除swap分区

    Linux如何创建和删除swap分区


      Linux中的swap分区类似Windows的虚拟内存,在硬盘空间不足的情况下,可通过创建swap分区来解决,下面小编就给大家介绍下Linux如何创建和删除swap分区。
      1.swap概述
      Swap分区,即交换区,Swap空间的作用可简单描述为:当系统的物理内存不够用的时候,就需要将物理内存中的一部分空间释放出来,以供当前运行的程序使用。那些被释放的空间可能来...