Linux and Windows dual system boot issues (Win7 + ubuntu14.04 + legacy BIOS + MBR)

Source: Internet
Author: User
Tags windows support

      • Computer startup
      • Disk partition Table MSDOSMBR and Gptguid partitiontable
        • 1 MBR partition table
        • 2 GUID partition TABLEGPT partition table
      • Multiple system Boot
      • BIOS and UEFI

1. Computer startup

When we install multiple systems on a single host (such as Win7 and Ubuntu14.04), we will encounter problems with which system is booting up. The typical scenario here is to install Ubuntu First, and then install Win7, and there will be a problem with Ubuntu startup missing. My computer is Legacy BIOS+MBR, most of the solution is to use the Windows Startup Manager EasyBCD, refer to http://www.crazyant.net/781.html, add entry, but it does not work, You may experience a situation where the Linux boot partition could not be found. It doesn't work for me anyway. Another solution is to use the GRUB2 under Linux, you can refer to http://blog.csdn.net/ethan_xue/article/details/7538568, but after completing the sudo update-grub, reboot directly, directly into a grub command line. So refer to Http://askubuntu.com/questions/121008/server-boots-to-grub-prompt-after-reboot, find a solution. There are several steps to follow:
1. In the grub command line to knock LS, will list a lot of partitions, for example (HD0,MSDOS8), you need to know which partition your Linux installation in such as mine is sda8. And then execute a few commands like this
2. Set root= (hd0, Msdos8)
3. Linux/vmlinuz root=/dev/sda8 RO
4. initrd/initrd.img
5. Boot
Wait a while and you'll start Ubuntu. After entering Ubuntu, execute the update-grub command and restart again to find the Grub command line interface again. Then re-execute the above steps, after entering Ubuntu and then execute GRUB-INSTALL–RECHECK/DEV/SDA, and then reboot, the result is successful. After a lot of reloading the system, want to find out about the principle of partition and multi-system start, the following will be described in detail.

2. Disk partition table Msdos (MBR) and GPT (GUID partitiontable)

We know that both Windows and Linux are stored on disk and are booted by their own boot program boot loader. When the computer is powered on, it has to find the boot loader that booted them. To find the boot loader, it is necessary to have metadata information describing the boot loader location. However, there is no program in memory after the computer is power-up? How do I find metadata information? First of all, we need to know that the computer will run the first program after the switch is pressed, but this program is not the operating system program, the program is actually the firmware (the program has been written to the motherboard), which is the BIOS (Basic input/outputsystem). The purpose of this BIOS is to do a variety of hardware detection, reading parameters, and stored in the CMOS. At this point, one of the functions of the BIOS is to find the boot loader. Different computer manufacturers are developing their own BIOS, and boot loader on disk, if you need to unify, the best way is to agree to boot The loader must be installed in a fixed location on the disk (such as 512Bytes of the first sector of the disk) so that the BIOS reads boot loader to memory. Therefore, the early design is the main boot record MBR (master boot Record), which contains the boot loader, it has 446Bytes. The next 64Bytes is the partition table. MBR is supported by both Windows and Linux. About the design of MBR, but also a chicken eggs and eggs of the problem of raw chickens. In computer science, it is true that there are many such cases. For example, the relationship between the GCC and C programs we are using now, it is strange to remember that I had been confused for a freshman. Since the C program has to be compiled with GCC to run, and GCC itself is the C language program, how is GCC compiled, gcc? The first solution is that GCC is compiled by other language compilers. What compiler compiler does the other language compile? In other words, there must be a god-like compiler, which does not have to compile at first. What exactly is this god-like compiler? People who have learned the Assembly should know that assembly language is the closest to the hardware, and if your program is written in assembly language, then you need a assembler, but at the very beginning there is a assembler. In fact, assembly language is also called mnemonic, and each instruction corresponds to a binary code. Oh, God compiler is actually people ah ... In the early days of the computer, in fact, they wrote the program on the note, then the Control Code table, step by step translation into machine language. The human brain is the slowest compiler for computing, but it is the God compiler for computers. Another case is machine learning, there are a lot of such problems, input a batch of data, training, and then output the results, tuneThe integer parameter and the output as input. In this way, there is the problem of output or input first, but the problem is that there is no initial input and output. The way to do this is to manually set an input, such as a batch of random input data. Finally, there is a more common description of the data, which we call Meta data metadata. Metadata is a chain that always points to the target data, while the target data can also contain the ability to discover metadata, which in a bidirectional chain also requires an initial metadata, which may be artificially set to die. Here's a look at how disk partitioning designs data and metadata.

2.1 MBR partition table

Whether Windows or Linux have partitions, Windows is C D E F, etc., Linux is/dev/sda1/dev/sda2/dev/sda3/dev/sda4 and so on. Disk start Bytes is divided into:
-Main boot Record area (Master boot Record, MBR): Where the boot management program can be installed, there are 446 Bytes
-Partitioned tables (partition Table): Record the status of the entire hard disk partition, with a Bytes
-Each item in the partition table is a Bytes, the specific format can refer to https://en.wikipedia.org/wiki/Master_boot_record,https://en.wikipedia.org/wiki/ Extended_boot_record, each item records the starting cylinder number of the partition, which accounts for 3 Bytes, so that the early MBR design makes the partition maximum of 2.2T. You can divide up to 64/16=4 partitions, such as 1 (Pictures from Brother Bird). Windows may be called Cdef disks, and Linux is/dev/sda1/dev/sda2/dev/sda3/dev/sda4.

Figure 1
To be able to break the limit of up to 4 partitions, for each partition, it can be divided into primary and extended. Extended can also continue to be divided into logical partition. In fact, if a partition is Extended, it does not actually occupy space, and when it continues to be divided into logical, it is written to EBR (Extended Boot Record) at the beginning of each logical partition. You can refer to Https://en.wikipedia.org/wiki/Extended_boot_record, 2 is a case with logical partitioning.

Figure 2
The file names of the above partitions in the Linux system are as follows:
-P1:/DEV/SDA1
-P2:/dev/sda2
-L1:/dev/sda5
-L2:/dev/sda6
-L3:/DEV/SDA7
-L4:/dev/sda8
-L5:/DEV/SDA9
You will find no Sda3 and sda4. Since 1234 is reserved, the logical partition of the P,MBR format must start from number 5th.
The characteristics of MBR main partition, extended partition and logical partition we make a simple definition:
-Primary and extended partitions can have up to four strokes (limit on hard disks)
-Extended partitions can have at most one (operating system limit)
-Logical partitions are partitions that are continuously cut out by the extended partition;
-the partition that can be formatted as the data access is the primary partition and logical partition. The extended partition cannot be formatted;
-The number of logical partitions varies according to the operating system, and the SATA drives in the Linux system can exceed more than 63 partition limits;

2.2 GUID partition TABLE,GPT partition table

MBR is a sector of the bytes, the partition has a capacity limit, if you have a 80T disk array, then to use all the space, it must be 2TB such segmentation, very troublesome. And the MBR has only one, if broken can not be repaired. GPT is a new partition table, it has 34 called LBA (Logical Block Address), default Bytes, starting from LBA0, so LBA0 is compatible with MBR.
Unlike MBR, which uses only the first 512Bytes chunk to record, GPT uses 34 LBA chunks to record partition information! At the same time with the previous MBR only one chunk, was killed in the case of the death of the light, GPT in addition to the previous 34 LBA, the entire disk of the last 33 LBA also take as another backup! This may be more secure!
The detailed structure is a bit like the 3 appearance:

Figure 3
Although the new version of Linux mostly knows the GPT partition table, however, on the Disk Management tool, FDISK this veteran software does not know GPT Oh! To use GPT, you have to do something like gdisk or parted instructions! In addition, the boot management program, GRUB first version does not know GPT! You have to GRUB2 to know later! Not all operating systems can read to the GPT disk partition format! At the same time, not all hardware can support GPT format Oh! The ability to read and write GPT format is related to the boot detection program!

3. Multiple system Boot

After recognizing the partitioning and boot management program, let's look at how multiple system booting works. Boot Manager boot loader is available for each operating system. Boot loader are generally in the 446Bytes of MBR or EBR. When the BIOS first reads to the boot loader in the MBR, the boot loader starts the operation of the operating system. The main tasks of Boot loader are:
Menu: Users can choose different boot items, which is also an important function of multiple boot!
Load the core file: direct point to the bootable program section to start the operating system;
Transfer Other loader: Transfer the power-on management function to other loader responsible;
The 3rd feature is the key to complete multiple system start-up. In fact, it is not just the first sector of the disk that has boot loader in the MBR, and boot loader can be installed at the beginning of other partitions of the disk, which is why multiple operating systems can be stored in different partitions and started. If the bootloader of an operating system can have a handoff function, then the multi-system boot can be implemented. Multiple system start-up is done by transferring the function chain.
Let's say for example, suppose your PC has only one hard disk, which is cut into four partitions, with Windows and Linux installed in the first to second partition, how do you choose to boot with Windows or Linux on boot? Assuming that the MBR is installed in the Windows/linux operating system can also know the boot management program, then the entire process can be shown in Figure 4 as follows:

Figure 4
The boot loader in the MBR will first give the menu, choose to start Windows directly or enter the boot loader of Linux, if you choose Linux boot loader, then the menu selection will continue to find that only Linux, directly start Linux. The key here is whether the boot loader in the MBR read by the BIOS provides a menu and a transfer function.
A typical example is installing Linux and then installing Windows, and you won't find Linux at this point. Because the boot loader of Windows will overwrite the MBR, and Windows boot loader only recognize itself, it is no longer possible to open Linux. At this point, you need to modify the boot loader of the MBR so that it can find both Windows and Linux, and the available tools include grub under Windows EASYBCD Linux. GRUB2 supports multiple power-on, so Linux uses grub to write to the MBR to perform multiple boot functions.

4.BIOS and Uefi

About BIOS and UEFI (Unified extensible Firmwareinterface), he is the BIOS upgrade version only. The BIOS cannot read the GPT, but UEFI can read it. And Uefi joins a so-called Secure Boot (secureboot) mechanism, which means that the operating system that is about to boot must be verified by UEFI, otherwise it will not be able to boot smoothly! Microsoft has used many of these mechanisms to manage hardware. However, after joining this mechanism, many operating systems, including Linux, will probably not be able to boot smoothly! So, at some point, you might have to turn off Uefi's secureboot feature to get into Linux. Traditional environment is generally legacy BIOS+MBR, such as my previous HP compaq320 This is the case, the installation is win7+ ubuntu14.04 dual system, using the GRUB2 boot program, which is Win7 and the following WinXP are supported by a combination, now the new computer is generally UEFI+GPT (Lenovo small New 700 is), XP is not supported, and Win7 64bit only support uefi+ Gpt. To see if your computer is legacy BIOS or UEFI, you can press the key combination Win+r enter MSINFO32 in the run, you can see whether it is BIOS or UEFI, on the right click on my computer, management, Disk Management, on the disk right-click Properties, enter the volume, You can see whether it is an MBR or a GPT partitioned table format.
for UEFI's advantages over BIOS, you can refer to http://www.iruanmi.com/what-is-gpt-and-what-is-uefi/, which also provides a version of the Windows system that supports UEFI+GPT startup. The following table lists the support for GPT disks for each version of the Windows operating system:

32-bit Windows support for GPT partitioning

64-bit Windows support for GPT partitioning

Be sure to find out if your PC motherboard supports UEFI before installing the system, and then the partitioned table is MBR or GPT. As to whether the motherboard supports UEFI or not, if you have not yet installed any of the system's machines, you have to go to the BIOS to see if you want to start WINDOWS7/8 by UEFI and the computer needs to support UEFI boot. PCs preinstalled with WIN8 support UEFI boot. Over the last two years, many motherboards also support UEFI boot. Boot appears brand logo press F2 (or DEL, ESC and other keys, do not pass the brand key) into the Bios/uefi settings, in the boot item or similar to see if there is efi/uefi related options, if any, then the computer support UEFI boot.

Reference: "Bird's private Cuisine" Basic article Fourth Edition chapter II
BIOS and UEFI:
Http://www.ihacksoft.com/uefi.html
Http://www.voidcn.com/blog/hanwang3/article/p-4839839.html
Multi-system boot:
http://blog.csdn.net/canghai1129/article/details/38655899
http://blog.csdn.net/ethan_xue/article/details/7538568
Http://askubuntu.com/questions/121008/server-boots-to-grub-prompt-after-reboot
Http://wiki.jikexueyuan.com/project/learn-linux-step-by-step/boot-loader.html

Linux and Windows dual system boot issues (Win7 + ubuntu14.04 + legacy BIOS + MBR)

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.