centos 6如何恢複被刪除了的boot分區

來源:互聯網
上載者:User

Centos6系統/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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.