Build a dual-boot Linux system on a single hard drive

Source: Internet
Author: User
Multiple Linux installations that can be used allow you to easily test different libraries of the same program and observe how your program interacts with other programs, or you can just adjust the parameters everywhere to see what will happen. This will be useful for development and testing-and customer support sooner or later. Suppose you do not have many machines? Don't worry-install on a single machine

Multiple Linux installations that can be used allow you to easily test different libraries of the same program and observe how your program interacts with other programs, or you can just adjust the parameters everywhere to see what will happen. This will be useful for development and testing-and customer support sooner or later. Suppose you do not have many machines? Don't worry-installing multiple Linux instances on a single machine is easy because you will soon find this point from this tip, this article was written by IBM intern Chuks Onwuneme and Farhan Khawaja.
As a partner of IBM Developer Relations, our task involves helping technical support personnel answer customer's questions (in other words, we Help Desk ). We mainly use IBM WebSphere products-one of the most common cases is the need to work with machines to reproduce actual customer problems.

In terms of words, recreating each problem means having the same system as the customer, of course, partitioning and running multiple systems on each drive is much more effective than using a separate machine for each system. Therefore, several months ago, we converted the method from one machine in each system to multiple systems in each machine.

Now, we can (for example) run two different versions of IBM WebSphere Application Server on the same operating system. All you have to do is divide the large drive (usually 19 GB in our lab drive) into two partitions and install the operating system on each partition, then, install a version of Websphere Application Server on each partition. In this way, we have multiple copies running in a similar environment on a machine.

In the IBM lab, we use a variety of operating systems, including several Microsoft Windows and NT derivative systems (Windows 2000 Server and Professional, NT Server and NT Professional) and AIX and Linux (Red Hat 6.2 ).

The Microsoft system contains a utility for installing multiple operating systems and is easy to convert. However, we are new to Linux, and the Red Hat system brings us some trouble, especially because it is difficult to find simple and clear documents to guide us. Therefore, we have provided this article, hoping that new Linux users who may face the same problem will easily find this document and find it clear, refined, and easy to use. If we succeed, please be sure to tell us (you can find our email address at the top and bottom of this article ).

Our tip article involves installing multiple instances of the same Linux release on a single drive (we use Red Hat in the lab ). However, as long as you make a slight adjustment (or with the help of some of the documents listed in the references), for creating a machine with a dual-boot combination of different Linux or Linux and non-Linux operating systems, there should be no problem.

In this article, we use an old version of Red Hat because we tried to build a system that is exactly the same as the customer. Therefore, the Red Hat version used here is a few years ago and uses the earlier 2.2 kernel. Compared with the new Linux kernel, the multi-boot mode is different. For security reasons, it is wise to upgrade to a newer Linux 2.4 (. x) kernel version whenever possible. In addition, most Linux installations now provide GRUB to replace LILO or supplement LILO. This feature provides a more advanced way to handle Linux multi-boot features. In this way, if you are using a newer version without LILO, the following techniques may not be very useful-but if your version uses LILO, it is indispensable.

Red Hat dual boot: Installation Instructions

When you are about to start this process, first shut down the system and then restart it. Then, add the Red Hat Linux CD to the drive.

The Red Hat Linux installation routine guides you through a simple installation process. You must complete some basic system configurations, such as selecting the default language and keyboard type. Enter the correct information until the "Partitions" screen appears.

When the screen appears, click "add" and select "Linux Native" as the operating system type. For "size", enter 16 (MB) and select/boot as the partition type. The remaining configurations are given below. for specific partitions, you can repeat the preceding commands to complete the configuration.

/Boot sda1 16 M Linux native

/Sda5 1024 M Linux native

Swap sda6 256 M Linux swap

/Var sda7 200 M Linux native

/Tmp sda8 200 M Linux native

Note that these directory locations are for SCSI drives. For IDE drives, simply replace s in sdal with h (make your hda1 A/boot drive and hda5 a root drive ).

Note that the above sizes are suitable for our hardware-they are not mandatory. You can flexibly choose any size suitable for your hardware, especially because the current newer hardware supports various configurations. However, do not allocate too much space to the "/boot" Partition, because most of the space will eventually be wasted-on the latest hardware, you may want a boot area that is smaller than our boot partition. Similarly, you can use other sizes for other partitions.

Installation tag 2

Now, you are preparing to install the second Linux kernel instance. Follow the following simple principles:

Install lilo again on the Master Boot Record (MBR)

Linear Mode (strictly required for SCSI drives)

Leave few kernel parameters empty

The initial installation partition should still be marked as "Not Set ". Keep them as Not Set, and then add five new partitions by clicking "add" and installing as specified above. You only need to add new partitions all the time and do not need to delete or edit the previously installed partitions.

The remaining installation remains unchanged. You can use any of your favorite names (we use linux2 ). However, if there are multiple characters in the label, ensure that they are enclosed in quotation marks (that is, if you want to retain spaces, use "Linux 2 "). Of course, be sure to mark the second installation with a different name than the first one.

After the installation, the system restarts and prompts. Press the Tab key to display the second Linux installation label. Enter "linux2" (or any name you specify for the second image) and press Enter. this will bring up the second Linux system you just installed.

Edit lilo. conf

Next, we will edit the LILO. conf configuration file of lilo (Linux loader) to add a record to tell Linux about the first installation we have completed.

To do this, go to the/etc directory and open the lilo. conf file in your favorite editor (you may want to create a backup copy first, just in case ). The lilo. conf code is similar:

Boot =/dev/sda # this points to the boot device

Timeout = 300 # if no activity in the specified time, load default image

Linear

Prompt

Default = "Linux2" # Linux1 will be displayed at the prompt

Vga = normal # video mode

Read-only

Map =/boot/map

Install =/boot. B

Image =/boot/vmlinuz = 2.2.14-5.0 # location of boot image

Label = "Linux2" # label

Initrd =/boot/initrd-2.2.14-5.0

Root =/dev/sda10 # location of root partition

Note: The computer ignores comments (starting with # or a well number ). Include them here so that you can understand the purpose of each row correctly-you do not have to include these comments in the lilo. conf file on your system unless you want to keep them for reference.

Similarly, if you use an IDE drive, remember to replace sda with hda.

Another method for configuring LILO

Here is an alternative method to edit the lilo. conf file.

Open a terminal window, go to the "/root" directory, and enter linuxconf. This will take you to the Linux command window where you can configure the system.

Scroll down until Boot mode. In "boot mode", you should see the LILO configuration option. Select the second item "Configure LILO Linux configurations" on the menu, and click the "LILO Linux configurations" tab.

Click Add ". You can then add locations of other Linux boot partitions and kernel files. If you are not sure what information you want to add to each field, view the list before entering.

Take a look at the lilo. conf file above, and you will notice that it is a Linux installation labeled linux2, that is, the second one we installed during the installation process. Now, to enable LILO dual boot to install the first Linux instance on the/sda5 (for the IDE drive is/hda5) partition, add the following content in the last line:

Image =/boot/vmlinuz = 2.2.14-5.0

Label = "Linux1"

Initrd =/boot/initrd-2.2.14-5.0

Root =/dev/sda5

Therefore, after editing the above code, the final file should be similar:

Boot =/dev/sda

Timeout = 300

Linear

Prompt

Default = "Linux2"

Vga = normal

Read-only

Map =/boot/map

Install =/boot. B

Image =/boot/vmlinuz = 2.2.14-5.0

Label = "Linux2"

Initrd =/boot/initrd-2.2.14-5.0

Root =/dev/sda10

Image =/boot/vmlinuz = 2.2.14-5.0

Label = "Linux1"

Initrd =/boot/initrd-2.2.14-5.0

Root =/dev/sda5

Make sure that the root path is specified as completed in the last line above.-This is very important. Make sure that the labels you used during installation are listed.

Now Save the file and enter the command lilo at the prompt. This will re-compile the file and save the updated configuration.

Note: image/kernel is the same for the two installations (/boot/vmlinuz = 2.2.14-5.0 ). Because we are working on a dual boot with identical systems and are installing from the same CD, we have the same image file. If you are installing different releases, these files will be different.

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.