Boot/boot recovery deleted in CentOS 6 system simple Introduction

Source: Internet
Author: User
Tags ssh secure shell

In the CentOS 6 system, the boot partition was deleted because of careless or operational errors.


Is it possible to recover the deleted boot partition if this is the case?


1. First use the CENTOS6 image to enter the Linux rescue rescue mode.


650) this.width=650; "style=" width:600px;height:196px; "alt=" How to Restore "src=" from the boot partition removed by CentOS 6 http://image.mamicode.com/ Info/201506/20180923152342983786.jpg "width=" 670 "height=" 223 "/>


2. Start the sshd service, view the IP address acquired by the eth0, and connect with the 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. [[email protected] ~]# cd /boot //Enter/boot partition [[email protected] 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 [[email  protected] boot]# cd . return to Upper directory [[[email protected] /]# rm -rf /boot/*//] Delete/boot partition all contents [[email protected]  /]# ls /boot//view/boot partition content is empty [[email protected] /]# mount /dev/sr0 /mnt Mount the CDROM device to the/MNT directory mount:&Nbsp;block device /dev/sr0 is write-protected, mounting read-only [[email  protected] /]# rpm -ivh /mnt/packages/kernel-2.6.32-71.el6.i686.rpm --root=/ --

Kernel package for Force//installation CD

 

Preparing ... ########################################### [100%] 1:kernel ########################################### [100%] [[  Email protected]/]# ls/boot//view/boot partition content 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 [[email protected]/]# mkdir/boot/grub//Create a new grub directory in the/boot directory [[email protected]/]# touch/boot/grub/grub.conf//Create a new grub.conf configuration file [email Protected]/]# cp-rf/usr/share/grub/i386-pc/*/boot/grub///

Copy all the contents of the/usr/share/grub/i386-pc to the/boot/grub.

  

[[email protected] /]# 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 [[email protected] /]# 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 [[email protected] /]# fdisk -l //View Partition 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//this boot partition for/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 //this for/root partition [[email protected] /]#  mount//View all Mount Partitions/dev/sda3 on / type ext4  (rw)//root partition/dev/sda1 on /boot  type ext4  (rw)//boot partition for 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) [[email protected] /]# grub//Boot 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)  //First find /grub/stage1 view/boot partition for (hd0,0) root  (hd0,0)//set/boot partition to/DEV/SDA1 Filesystem type is ext2fs, partition type 0x83 Grub " setup  (hd0)// Reinstall 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 is embedded. Succeeded Running "Install/grub/stage1 (hd0) (hd0) 1+26 P (hd0,0)/grub/stage2/grub/grub.conf" ...  Succeeded done. Grub "quit//exit

3. Re-reboot boot system into grub interface test


650) this.width=650; "style=" width:600px;height:328px; "alt=" How to Restore "src=" from the boot partition removed by CentOS 6 http://image.mamicode.com/ Info/201506/20180923152343294313.jpg "width=" 670 "height=" 369 "/>


4. Find Find/grub/stage1 and then locate the/boot partition for (hd0,0), specify KERNEL,INITRD, boot boot system succeeded.


650) this.width=650; "style=" WIDTH:595PX;HEIGHT:317PX; "alt=" How to Restore "src=" from the boot partition removed by CentOS 6 http://image.mamicode.com/ Info/201506/20180923152343533555.jpg "width=" 670 "height="/>


5. The system starts successfully and then goes to the system to re-write the/boot/grub/grub.conf file.


650) this.width=650; "style=" width:539px;height:241px; "alt=" How to Restore "src=" from the boot partition removed by CentOS 6 http://image.mamicode.com/ Info/201506/20180923152343891931.jpg "/>


6.[[email protected]/]# vi/boot/grub/grub.conf configuration file is as follows:


Finally fill in the grub.conf file content

Default=0//Default menu is the first one

timeout=6//wait time is 6 seconds

Title Mylinux//start titled Mylinux

Root (hd0,0)//boot is located in the same partition as/DEV/SDA1

kernel/vmlinuz-2.6.32-71.el6.i686 ro Root=/dev/sda3 rhgb Quiet//kernel is located in read-only mode mount/dev/sda3 root partition rhgb quiet for quiet mode does not display kernel information.

initrd/initramfs-2.6.32-71.el6.i686.img//load the INITRD image.


7. Finally enter Linux rescue to recreate a grub


650) this.width=650; "style=" width:600px;height:255px; "alt=" How to Restore "src=" from the boot partition removed by CentOS 6 http://image.mamicode.com/ Info/201506/20180923152344078442.jpg "width=" 670 "height=" 288 "/>


8. The final launch screen is as follows


650) this.width=650; "style=" width:600px;height:310px; "alt=" How to Restore "src=" from the boot partition removed by CentOS 6 http://image.mamicode.com/ Info/201506/20180923152344397758.jpg "width=" 670 "height=" 349 "/>


The above is the CentOS 6 recovery is deleted boot partition introduction, the step is a bit long, if you feel trouble can reload the system, the same can restore boot partition.


This article is from the "I am a Little bird" blog, please make sure to keep this source http://liyanchao.blog.51cto.com/9954601/1659891

Boot/boot recovery deleted in CentOS 6 system simple Introduction

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.