Build bootmgr boot for Ubuntu

Source: Internet
Author: User
To prevent normal Ubuntu boot from being affected by Windows reinstallation and maintenance, I usually try to write the MBR information back to Windows compatible code after Ubuntu is installed, ubuntu boot is used as an entry in the windows Startup manager bootmgr. 1. before Ubuntu9.10, grub4dos can easily meet the requirements. First, add a bootsector record using the built-in bcdedit tool.

To prevent normal Ubuntu boot from being affected by Windows reinstallation and maintenance, I usually try to write the MBR information back to Windows compatible code after Ubuntu is installed, ubuntu boot is used as an entry in the windows Startup manager bootmgr.

1. Before Ubuntu 9.10, grub4dos can easily meet the requirements. First, add a bootsector record using the built-in bcdedit tool.

Bcdedit/create/d "description"/application bootsector
Bcdedit/set {id} device partition = c:
Bcdedit/set {id} path \ grldr. mbr
Bcdedit/displayorder {id}/addlast
The description can be defined by yourself, and then grldr In the downloaded grub4dos. both the mbr and grldr files are placed on the drive C. After restart, you can select the bootsector to boot to the Ubuntu kernel. grub4dos can automatically search for the menus of each partition. lst file. Therefore, if you only want to boot to Ubuntu without any other requirements, you do not need to write a menu by yourself. lst file metadata. finally, use the bootsect or bootrec tool in PE to fix the windows-compatible MBR code to complete all the operations.

PS: if there is a hidden active partition and the grub4dos boot file needs to be put here, you need to use diskpart to Add/Remove the drive letter, the specified partiton In the second command to add the bootsector should also be modified as needed!

2. in Ubuntu 9.10, the default startup manager is changed to Grub2, which undoubtedly brings more advanced features such as modular design, unfortunately, it cannot be easily guided by grub4dos as before. Fortunately, grub2 developers still provide us with similar methods.

Add a bootsector item as before, but the third sentence is path \ g2ldr. mbr, and then the two files g2ldr. mbr and g2ldr are added? Google pull out) Put it under the active partition (usually drive C .. well, we won't repeat it later). Since grub2 won't search all the partitions for configuration files, we also need to copy all the related files in Ubuntu, by default, all files in the/boot directory are read by/boot/grub2/grub. cfg file to guide the system, if grub. if the cfg information is correct, it will be okay if it is successfully started theoretically. Finally, fix the MBR ~

3. In fact, there is a simplest way to take the above two cases, that is, directly make the MBR content into a boot file and then guide it through bootmgr. The method is as follows:

In Ubuntu

Sudo dd if =/dev/sda of =/media/win/grub2 bs = 512 count = 1
The dd command is used to copy the content of the first 512 bytes of the hard disk to the grub2 file./media/win is the Mount path of a windows drive letter and can be modified as needed, the grub2 name can be customized. Next, create a bootsector entry under windows, change the third entry to the parameter path to path \ grub2, and then upload the grub2 file generated by the dd command to the C drive ,, fix MBR. this is the simplest and most common method. recommended!

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.