Win7 and centos dual systems, reboot centos after win7 is reinstalled

Source: Internet
Author: User

Because it is Centos6.3 and win7 dual systems, the MBR is changed after win7 is reinstalled. The originally installed Centos is also guided in MBR, so it cannot enter Centos, therefore, use the Centos USB flash drive to enter the rescue mode. First, use df-h to find the disk number corresponding to each disk and then find the partition where the boot is located. perform the following operations:

Use df-h to check whether hdX or sdX is used. In this example, hd represents an IDE hard disk, and X is ~ Z represents the first few pieces. I think I have a USB flash drive, a hard disk. When it is displayed, the USB flash drive is displayed as sda and the hard disk is displayed as sdc. Find the identifier of your hard disk, check whether the hard disk has/boot mounting partitions. If yes, it indicates that boot is an independent partition. Otherwise, it is in the same partition as the root partition. Enter grub to enter the grub command line,

Write the MBR to the super block of the partition with the/boot directory. The command is as follows:
Grub enters the grub command line setup (sd1, 1). Because I use a USB flash drive, the USB flash drive is changed to sda (that is, sd0 is my USB flash drive ), after successful writing, export this super block (this super block is actually the MBR content)
Dd if =/dev/sdc2 of =/home/win7/linux. img
If you do not know which device to export, you can use df-h to obtain it. In win7, I use mkdir/home/win7, And then mount

/Dev/sdc10/home/win7 mount a fat32 disk to linux and export it. Then you can enter win7 to get the file, and remember to edit/boot/grub/menu. the lst file allows this super block to correctly guide Centos and Win7, and then enter win7 to generate linux. place img on the boot disk C and create a boot. INI file, you can also take one test from XP, add the following red statement to guide the MBR of the partition where Centos is located

[Boot loader]
Timeout = 8
Default = multi (0) disk (0) rdisk (0) partition (1) \ WINDOWS
[Operating systems]
Multi (0) disk (0) rdisk (0) partition (1) \ WINDOWS = "Microsoft Windows XP Professional"/noexecute = optin/fastdetect
C: \ linux. img = "Centos_6_3"

Then, when Windows 7 is started, we can see the "Centos_6_3" startup Item. after entering the item, we can correctly guide centos.

Add the following menu. lst as a reference:

# Grub. conf generated by anaconda

#

# Note that you do not have to rerun grub after making changes to this file

# NOTICE: You have a/boot partition. This means that

# All kernel and initrd paths are relative to/boot/, eg.

# Root (hd0, 1)

# Kernel/vmlinuz-version ro root =/dev/sdb9

# Initrd/initrd-[generic-] version. img

# Boot =/dev/sda
Default = 0
Timeout = 5
Splashimage = (hd0, 1)/grub/splash.xpm.gz
Hiddenmenu

Title CentOS (2.6.32-279. el6.i686)

Root (hd0, 1)

Kernel/vmlinuz-2.6.32-279.el6.i686 ro root = UUID = export rd_NO_LUKS KEYBOARDTYPE = pc KEYTABLE = us rd_NO_MD crashkernel = 128 m lang = zh_CN.UTF-8 rd_NO_LVM rd_NO_DM rhgb quiet
Initrd/initramfs-2.6.32-279.el6.i686.img

Title Windows7

Rootnoverify (hd0, 0)

Chainloader + 1

Note: It seems that hard disks and USB flash disks in grub are expressed in hd, so they are displayed in menu. there will be no sd in lst; sda and hda are only used in linux to indicate IDE or sata interface. This is just my guess and is not necessarily accurate.

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.