CentOS 6 How to recover a deleted boot partition

Source: Internet
Author: User
Tags config ssh centos ssh secure shell

The CENTOS6 system/boot partition is removed, but does not want to reinstall the system, here is a quick way to recover the boot partition.

1. First use CENTOS6 mirroring into the Linux rescue rescue mode.

2. Start the sshd service, view the IP address that eth0 obtains, and then connect with 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 the SSH Secure Shell is a non-commercial version.

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

[Root@localhost ~]# cd/boot/Enter/boot partition

[root@localhost boot]# LS//View the contents of the boot partition

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 ... Back to Upper Directory

[root@localhost/]# rm-rf/boot/*//Delete all contents of/boot partition

[Root@localhost/]# ls/boot//View/boot partition content is empty

[Root@localhost/]# mount/dev/sr0/mnt//Mount cdrom device to/mnt directory

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//installation CD kernel package

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

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

[Root@localhost/]# ls/boot//view/boot partition contents

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//creates a new grub directory in the/boot directory

[Root@localhost/]# touch/boot/grub/grub.conf//Create a new grub.conf configuration file

[Root@localhost/]# cp-rf/usr/share/grub/i386-pc/*/boot/grub///Copy all/usr/share/grub/i386-pc contents to/boot/grub.

[Root@localhost/]# ls/boot//view/boot partition contents

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///view/boot/grub directory contents

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.