位置: 编程技术 - 正文

CentOS 6误删除的boot分区该如何还原恢复(centos7误删除怎么恢复)

编辑:rootadmin

推荐整理分享CentOS 6误删除的boot分区该如何还原恢复(centos7误删除怎么恢复),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:centos文件删除,centos7删除的文件如何恢复,centos文件删除,centos7误删glibc后恢复,centos7误删glibc后恢复,centos6.5删除文件,centos误删文件,centos误删文件,内容如对您有帮助,希望把文章链接给更多的朋友!

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

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

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

  SSH Secure Shell 3.2.9 (Build )

  Copyright (c) - SSH Communications Security Corp -   This copy of SSH Secure Shell is a non-commercial version.

  This version does not include PKI and PKCS # functionality.

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

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

  config-2.6.-.el6.i symvers-2.6.-.el6.i.gz

  grub System.map-2.6.-.el6.i

  initramfs-2.6.-.el6.i.img vmlinuz-2.6.-.el6.i

  [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.-.el6.i.rpm --root=/ --force //安装光盘的kernel软件包

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

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

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

  config-2.6.-.el6.i System.map-2.6.-.el6.i

  initramfs-2.6.-.el6.i.img vmlinuz-2.6.-.el6.i

  symvers-2.6.-.el6.i.gz

  [root@localhost /]# mkdir /boot/grub//在/boot目录新建一个grub目录

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

  [root@localhost /]# cp -rf /usr/share/grub/i-pc/* /boot/grub/ //把/usr/share/grub/i-pc的所有内容拷贝到/boot/grub中。

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

  config-2.6.-.el6.i symvers-2.6.-.el6.i.gz

  grub System.map-2.6.-.el6.i

  initramfs-2.6.-.el6.i.img vmlinuz-2.6.-.el6.i

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

  e2fs_stage1_5 iso_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: .5 GB, bytes

   heads, sectors/track, cylinders

  Units = cylinders of * = bytes

  Sector size (logical/physical): bytes / bytes

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

  Disk identifier: 0xb1db4

  Device Boot Start End Blocks Id System

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

  Partition 1 does not end on cylinder boundary.

  /dev/sda2 Linux swap / Solaris

CentOS 6误删除的boot分区该如何还原恢复(centos7误删除怎么恢复)

  Partition 2 does not end on cylinder boundary.

  /dev/sda3 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 iso (ro)

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

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

  GNU GRUB version 0. (K lower / K 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 0x

  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)”。。。 sectors are embedded.

  succeeded

  Running “install /grub/stage1 (hd0) (hd0)1+ p (hd0,0)/grub/stage2 /grub/grub.conf”。。。 succeeded

  Done.

  grub》 quit//退出

  3.重新reboot启动系统进入grub界面测试

  4.查找find /grub/stage1然后找到/boot分区为(hd0,0),指定kernel,initrd, boot启动系统成功。

  5.系统启动成功,然后进入系统重新写/boot/grub/grub.conf文件。

  6.[root@localhost /]# vi /boot/grub/grub.conf配置文件如下:

  最后填写grub.conf文件内容

  default=0 //默认菜单为第一个

  timeout=6//等待时间为6秒

  title mylinux //启动标题为mylinux

  root (hd0,0) //boot所在分区为/dev/sda1

  kernel /vmlinuz-2.6.-.el6.i ro root=/dev/sda3 rhgb quiet//kernel所在位置以只读模式挂载/dev/sda3根分区rhgb quiet为安静模式不显示内核信息。

  initrd /initramfs-2.6.-.el6.i.img//加载initrd镜像。

  7.最后进入linux rescue重建一个grub

  8.最后启动界面如下

  上面就是CentOS 6恢复被删除boot分区的方法介绍了,步骤有些长,如果觉得麻烦的话可以重装系统,同样能恢复boot分区。

Linux系统怎么更新补丁?Centos6更新系统的教程 Windows自动更新大家都知道或者用过吧,那么同样作为服务器阵营的linux系统。Linux系统怎么更新软件补丁呢,下面使用最广泛的的centos系统为例,其他发

Centos系统网卡怎么手动配置? 平时装linux系统用工具配置网络经常出一些搞不清楚的问题,在这里分享一下手动在linux系统里配置网卡1、首先登陆到root账户下2、输入cd/etc/sysconfig/netwo

centos忘记密码怎么重置root密码? 在使用Linux系统的时候root密码是十分关键的安全机制。但是假设那天丢失了root密码的话问题就严重了。下面为大家介绍CentOSroot密码忘记的解决办法。1

标签: centos7误删除怎么恢复

本文链接地址:https://www.jiuchutong.com/biancheng/362226.html 转载请保留说明!

上一篇:在 CentOS 7 系统上安装 Kernel 4.0的方法(centos7yum)

下一篇:Linux系统怎么更新补丁?Centos6更新系统的教程(linux系统怎么更改语言)

  • 生产经营所得个人所得税怎么申报
  • 递延所得税负债转回怎么理解
  • 信用代码证过期银行能转账吗
  • 销售净水器营业执照范围
  • 贷款利息不能抵扣进项税
  • 不征税收入怎么申报企业所得税
  • 耗材如何入账
  • 库存现金盘点表是不是原始凭证
  • 购进货品未取得发票如何处理
  • 免费赠送物业费活动语句怎么写
  • 代开专票作废退税怎么做账?
  • 房产公司办公室布局
  • 进口货物的价格国内销售需要考虑的税
  • 社保补助扶持给个人的钱是否需要缴纳个人所得税呢?
  • 慈善机构捐赠
  • 企业理财产品收益要交企业所得税吗
  • 电商公司怎么开发票
  • 企业年报最容易掉进的九大“陷阱”
  • 母子公司可以汇资金吗
  • 购入原材料没有发票只有入库单
  • 插值法求利率计算公式
  • 税费是哪个会计科目?
  • 应收账款账龄分析简单例题
  • 不需要缴纳增值税和免税的区别
  • 什么是城市维护费
  • 物流企业之间的竞争
  • 网络共享每次都要输入密码
  • u盘如何装系统win7
  • win11打不开英雄连2
  • 股东借款给公司会计分录
  • 结转损益类收入账户的余额会计分录
  • php用户会员系统
  • phpscanf
  • yolov2训练
  • php 调试工具
  • 企业发生的现金折扣应计入什么费用
  • 资产负债表项目填列的依据是
  • 如何用php制作网页
  • php构造函数重载
  • 31.JavaScript数组进阶,一网打尽数组操作函数slice、filter、map、reduce、some、every、find、splice
  • vue快速入门与实战开发
  • ci框架视频教程
  • thinkphp制作404跳转页的简单实现方法
  • 外埠存款通过哪个会计账户核算?
  • 织梦常用调用标签
  • 企业发生的直接进入当期损益的期间费用包括
  • 其他货币资金的明细科目有哪些
  • sql2012附加数据库方法
  • 个体户 查账
  • 公司无流水要交税不
  • 报销差旅费大于预借差旅费会计分录
  • 计提工会经费是什么凭证
  • 应付账款在贷方负数
  • 经纪代理代订机票差额专票抵扣
  • 金蝶软件版本号有哪些
  • open bsd
  • ubuntu写脚本
  • 笔记本win7win10双系统怎么装
  • ixapplet.exe - ixapplet是什么进程 有何作用
  • OpwareSE2.exe - OpwareSE2是什么进程 有什么用
  • windows8快捷键
  • cocos2d-x2.2.3和android平台环境的搭建
  • Node.js中的事件循环是什么
  • javascript数学函数
  • js 键盘码
  • node.js使用教程
  • node-js
  • 陌陌2021年最近事件
  • 深入理解中国式现代化
  • jQuery EasyUI中DataGird动态生成列的方法
  • js编写一个标准的单例模式类
  • python按位与操作
  • 广告业发票税率是多少 可以抵扣多少
  • 企业破产享有的债权可否提前到期
  • 湖北税务登不上去是怎么了
  • 个税完税证明在哪里开具
  • 征管基础平台app
  • 发票勾选后必须抵扣吗
  • 2008土地管理办法
  • 山东省关于公务员社会信用考察的规定
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设