Install FreeBSD, Linux, and Windows XP on the machine

Source: Internet
Author: User

Source: http://www.ddvip.net/

The increasing size of hard disks gives people more choices. Some people who are playing Linux are also trying more operating systems, and others who use Unix are also trying to use Linux, windows XP is more convenient to do some work. This article is based on this idea, so that three systems can exist in one hard disk and work well. This article focuses on the hard disk partition and grub configuration and installation of some of the main points and basic knowledge to explain, not too in-depth details, I hope this article will help you.

1. Before reading this article, we have several conventions:

GuideProgramChoose grub-the new boot program is powerful and flexible. I don't need to talk about it anymore. I will know what it knows, and I don't know its suggestions to find its materials, then change Lilo. :) Its function is why I chose it.
We use a hard disk as an example. If you have multiple hard disks, you need to change some hard disk name parameters in this article.
The last Convention is very important, that is, when you use this article for guidance, please back up your data first, even though I have carefully tested and tested each part in the full text, but it is successfully implemented only on my machine, and I do not guarantee that it is successfully implemented on your machine.

2. Let's clarify several concepts:

A hard disk can be divided into up to four primary partitions because only information of four partitions can be recorded in the MBR of the starting Boot Sector of the hard disk, one of the differences is that extended partitions are also one of the MBR primary records. That is to say, if you divide a hard disk into four primary partitions, you cannot divide it into extended partitions. If you want to divide it into one extended partition, then you can only divide it into three primary partitions at most.

Therefore, we can only divide it into four primary partitions, and only one partition is active. It is the partition accessed by default after the system is started and read into MBR, the operating system of the partition is read from the Boot Sector of the partition and guided to the system. However, after Lilo and grub of Linux are entered into MBR, there is another MBR Boot Mode, that is, you can directly specify a partition, load the Boot Sector of the specified partition from it, and guide the operating system of the partition.

As we all know, you can divide multiple logical partitions in the extended partitions. The extended partition information is recorded by MBR, while the logic partition information is recorded by the guided sector of the extended partition.

This part is very important. The following sections will focus on using this part of knowledge:
In Linux, the partition of the hard disk is named as follows.
If you only have one hard disk and install it on ide1, your hard disk name is hda in Linux, and the Partition Rules in the hard disk are as follows: divide the primary partition from 1 (note that the primary partition includes the extended partition, and the primary partition mentioned below is also so understandable), for example, you have divided three primary partitions in the hard disk. The first is 1, the second is 2, the third is 3, and so on. What about logical partitions? Because a hard disk can only have four primary partitions, the naming rules give 1, 2, 3, 4 to the primary partition, then the logical partition can only be named from 5, this is why we can see that logical partitions always start from 5. Now, we can name our hard disk. For example, the first partition of your first hard disk is hda1, the second partition of the first hard disk is hda2 ........, the first partition of the second hard disk is hdb1, the second partition of the third hard disk is hdc3, and so on. However, if your first hard disk is divided into two partitions, the second partition (hda2) is an extended partition, and two logical partitions are divided in the extended partition, the naming method is as follows:
The first partition is hda1.
Second partition (that is, extended partition): hda2
Second partition first logical partition: hda5
Second partition second logical partition: hda6
When you use fdisk-L to view the partition information, it will be displayed as follows:
Device boot start end blocks ID system
/Dev/hda1*1 638 5124703 + 83 Linux
/Dev/hda2 639 7476 39560062 + 5 extended
/Dev/hda5 7477 2615 514048 + 82 Linux swap
/Dev/hda6 2616 3890 10241406 83 Linux

The hard disk naming method of grub is slightly different from that in Linux:
Ide1 master disk, ide1 slave disk, ide2 master disk, ide2 slave disk named hd0, hd1, hd2, hd3, that is, replacing a-d with 0-3, the partition in each hard disk is also named after "1" in Linux, and the logical partition of the extended partition is named from "4, in Linux, the name of grub is reduced by 1. In the above example, the second partition of the third hard disk is named hd2, And the partition in the above example is as follows:
/Dev/hda1 ------- (hd0, 0)
/Dev/hda2 ------- (hd0, 1)
/Dev/hda5 ------- (hd0, 4)
/Dev/hda6 ------- (hd0, 5)

OK. All preparations have been completed. If you have any questions about the above content, you are advised to refer to other related content.

3. formal installation:
3.1 partition considerations:
The installation difficulty is that both FreeBSD and Windows XP must be installed in the primary partition, so we need to consider the hard disk partition.
The following is an example of a 40 Gb hard disk:
Since both FreeBSD and Windows XP must be installed in the primary partition, Linux can be installed in the extended partition or in the primary partition. So, this means we have to divide at least three primary partitions, one of which is the extended partition, the other two partitions are respectively for FreeBSD and WindowsXP, and Linux is installed in the logic of the extended partition. But I don't want to be more specific. I just want to divide it into four primary partitions, including an extended partition, which is divided into two logical partitions. In this way, our partition solution (described in Linux naming) it is settled:

/Dev/hda1 first primary Partition
/Dev/hda2 Second Primary Partition
/Dev/hda3 third main Partition
/Dev/hda4 fourth primary partition (that is, extended partition)
/Dev/hda5 extended partition first logical Partition
/Dev/hda6 extended partition second logical Partition

3.2 format the hard disk and use fdisk for low-level formatting (that is, partition ):
I use fdisk in DOS. You can also use other partitioning tools, such as fdisk in Linux. However, we recommend that you use only one partitioning tool to partition hard disks, the use of multiple partition tools may cause compatibility issues, making partition tables unusable. You can divide the partition Size Based on your actual needs. But there is a good suggestion that we divide a small logical partition in the extended partition, which is about twice the memory size, to Linux as the swap partition. The active partition is random and not required, this is entirely because grub does not boot the operating system from the active partition, but the operating system that can locate a specific partition and start the partition. I don't plan to write down the partitioning steps in detail here. There are too many references in this regard. I will search for them using Google and the page will pop up to show you the last week. (Exaggerated)

3.3 installation steps:
You can install FreeBSD or windows first, and then install linux. The reason is that Linux now has grub installation. We need to use grub to guide the three systems, you can install grub on MBR at the end of Linux installation without overwriting FreeBSD and Windows boot programs. Here I choose to install FreeBSD first.

3.3.1 install FreeBSD
In FreeBSD, the primary partition is called slice. The four primary partitions in the first hard disk of IDE are called wd0s1, wd0s 2, wd0s3, and wd0s4.
In Linux, place FreeBSD in the/dev/hda1 partition, use a CD to install it, insert it into the FreeBSD installation disk, and perform interactive installation after the CD is started, for installation instructions, see other related materials. On the partition page, select wd0s1 to install FreeBSD, and then press t to change the partition type. 165 is the FFS code of FreeBSD's partition type, then press W to finish writing. In the Select pilot program, you can select bootmanager and exit. Next, install the following steps, which is omitted here.

3.3.2 install Windows XP
In this step, install it in the second primary partition, that is,/dev/hda2. Select the second partition in the partition interface. We recommend that you format the partition using FAT32, in this way, the partition can be read and written in Linux, and NTFS can only be written in Linux. The installation steps below do not need to be mentioned. Everyone on Earth will press next.

3.3.3 install Linux and configure grub
In this step, install linuxArticleMore, there are many excellent articles. If you haven't installed Linux yet, you can read these articles first. Here I will only talk about some important points. In the partition interface, use the third partition,/dev/hda3, as the Linux installation partition. If you plan to use the partition as the swap partition in the extended partition, add it and format it together. OK !!, Yes. In the following steps, you must install grub into MBR. Grub cannot be used for boot from other locations. During installation, grub may not recognize FreeBSD In the first partition, or some other operating systems on your hard disk, it doesn't matter. We can make some modifications to grub so that it can guide these operating systems. The grub configuration in this example is provided here.
Windows can be detected, but FreeBSD may have some problems.

In grub configuration, modify/etc/grub. conf:
The/etc/grub. conf file after Linux installation may be similar to the following:

# grub. conf generated by Anaconda
# note that you do not have to rerun grub after making changes to this file
# notice: you do not have a/boot partition. this means that
# All kernel and initrd paths are relative to/, eg.
# root (hd0, 5)
# kernel/boot/vmlinuz-version Ro root =/dev/hda6
# initrd/boot/initrd-version.img
# boot =/dev/hda
default = 0
timeout = 10
splashimage = (hd0, 2)/boot/GRUB/splash.xpm.gz
title Linux (2.4.20-8)
root (hd0, 2)
kernel/boot/vmlinuz-2.4.20-8 Ro root = label =/1
initrd/boot/initrd-2.4.20-8.img
title dos
rootnoverify (hd0, 1)
chainloader + 1

I want to explain some of the main lines. I want to annotate the lines with # headers. I don't need to worry about it.
Default = 0 indicates that the default option is the first title tag of the operating system to boot. Here is the Linux
Timeout = 10 means that if the user does not make a choice within 10 seconds, the operating system will be guided by the default option
This line of title Linux (2.4.20-8) is the title tag, and the subsequent content is displayed in the GRUB menu.
Root (hd0, 2) This line refers to the partition from which the operating system is guided, that is, the grub location partition operating system.
Kernel/boot/vmlinuz-2.4.20-8 Ro root = label =/1 this line is the path to the kernel given from the specified partition to boot the system
Rootnoverify (hd0, 1) and chainloader + 1 indicate that the chain pilot mode is used from a specific partition. In this example, grub locates the hd0, 1 partition, find the Operating System Boot Program of the partition and enable it to guide the operating system of the partition. In general, the Windows series is guided in this way.

In addition, here we use the title dos tag to guide Windows XP.

Now the three operating systems in the 40 Gb hard disk can guide two (If your WindowsXP cannot boot, set/etc/grub. change conf to the above class, and then perform the following steps );
Next, modify/etc/grub. conf so that it can guide FreeBSD,
Add the following content to/etc/grub. conf:
Title FreeBSD
Rootnoverify (hdx, Y)
Chainloader + 1
If you understand the statements of the boot block marked with DOS above, it is not difficult to understand the statements of the pilot block of FreeBSD. The above means to locate the hdx and Y partitions (hd0, 0 in this example, which is the partition where FreeBSD is installed), and then enable the pilot program for this partition, freeBSD is guided by the pilot program.
Another method can also be used to implement FreeBSD guidance. You can also try it, but it may not always succeed.
Add the following lines to/etc/grub. conf:
Titile FreeBSD
Root (hd0, x, y)
Kernel/boot/loader
X is your FreeBSD partition, and Y is the slice in which FreeBSD/is located.

OK! Save the changes. If everything goes well, restart the machine and you will see three options: Linux, FreeBSD, and DoS. Try to enter every system. If all the configurations are correct, you will see that every system can enter. If you find that a system cannot be accessed, find some grub information, which will provide you with detailed instructions.

If you have any errors or improvements in this article, please contact me for huangyiddle@21cn.com and I will be very grateful.

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.