zoukankan      html  css  js  c++  java
  • Linux 破坏性修复

    1、备份数据

    [root@rhel6 ~]# dd if=/dev/sda of=/root/backup/mbr.bak bs=512 count=1
    1+0 records in
    1+0 records out
    512 bytes (512 B) copied, 0.000181577 s, 2.8 MB/s
    [root@rhel6 ~]# cp /etc/fstab /root/backup/
    [root@rhel6 ~]# cp /etc/inittab /root/backup/
    [root@rhel6 ~]# cp /etc/rc.d/rc.sysinit /root/backup/
    [root@rhel6 ~]# cp /etc/rc.d/rc.local /root/backup/

    2、破坏性操作

    [root@rhel6 ~]# rm -rf /boot/*
    [root@rhel6 ~]# rm -f /etc/fstab 
    [root@rhel6 ~]# rm -f /etc/inittab 
    [root@rhel6 ~]# rm -f /etc/rc.d/rc.sysinit 
    [root@rhel6 ~]# rm -f /etc/rc.d/rc.local 
    [root@rhel6 ~]# dd if=/dev/zero of=/dev/sda bs=446 count=1
    1+0 records in
    1+0 records out
    446 bytes (446 B) copied, 0.00297539 s, 150 kB/s
    [root@rhel6 ~]# 

    3、选择修复模式

    从光盘启动,选择Rescure installed system

    不需要网络引导--->continue--->shell start shell

    4、修复fstab

    如果是逻辑卷系统,则需要执行lvm vgscan和lvm vgchange -ay 激活vg才能挂载。

    重启后,再次进入修复模式,如果看到chroot /mnt/sysimage,则说明/etc/fstab恢复成功。其实就是把原来的根分区挂载起来,然后利用原来的备份文件进行恢复,

    如果之前未进行备份,也可以手动编辑fstab文件来恢复。

    5、修复内核

    挂载光驱后,安装内核。

    6、恢复引导程序

    还需要手动添加grub.conf配置文件

    恢复init:

    两次exit退出图形界面,选择reboot 

    重启后系统自动执行selinux relabel,几分钟后自动重启,至此,系统修复完成。

  • 相关阅读:
    在网页上下载文件
    sql server 分离附加
    在vue中,ref属性与$refs对象的区别
    在ES6中,export default 和 export的区别
    element-ui之Table表格el-table标签
    element-ui之Form表单el-form标签
    使用Mybatis-Generator自动生成Dao,Entity,Mapping
    linux下普通用户与root的切换
    idea插件将下划线转驼峰形式
    利用wsdl2java工具生成webservice的客户端代码
  • 原文地址:https://www.cnblogs.com/rusking/p/7418374.html
Copyright © 2011-2022 走看看