Installing Multiple Distributions on the Same Computer Sanket Totewar
Total Page:16
File Type:pdf, Size:1020Kb
GRUB Installing Multiple Distributions on the same computer Sanket Totewar ith availability of the internet, Linux requires some familiarity with computer jar- has become accessible to nearly all gon and is not for the faint-hearted. It also Wthe parts of the world. And with the requires a brief understanding of partitions great freedom that this operating system of- as well as boot loaders. Plus there is a very fers, we can see a steep rise in the number of rare chance of losing data while playing with distributions released the world over. The five partitions. So, it is a good idea to back up all distributions shipped with this issue have al- important data before advancing any further. ways competed with each other for the num- ber one position. This has lead to new features Boot loaders and services emerging with every release. So, Let us see what happens in most cases to make the most of the services offered by when we turn on our computer. It is the job various distributions, most users often tend of the BIOS to find the primary bootable de- to install multiple distros and switch between vice (usually a hard disk) and load the initial them. This is commonly referred to as distro bootstrap program from the MBR. The MBR hopping and is a common practice between is an abbreviation for Master Boot Record newbies and experts alike. and is the first 512 bytes of the hard disk. This area stores a boot loader program Synopsis whose purpose is to load the operating sys- This article is geared towards helping you tem and transfer execution to it. The operat- seamlessly install and run multiple Linux ing system then initializes itself by loading distributions on the same computer. Also the necessary drivers and programs needed we shall tackle cases where MS Windows or for its normal operation. In case of multiple other operating systems are to be present operating systems, the main boot loader on the same PC. In the article, I am taking transfers control to other operating systems Windows as an example, because it is the or their individual boot loaders depending most common case. on the computer configuration. Although great care has been taken to The boot loader is hence a very important explain various concepts in detail, this article utility for a Linux distro hopper. Various distri- butions use a variety of boot loaders like GRUB and LiLo for the above mentioned purpose. Of these, GRUB is known to be very popular due to its stability and multi-boot support. GRUB is an abbreviation for Grand Unified Boot loader and is used by GNU and most Linux distribu- tions. Recently, GRUB 2 has replaced older versions of GRUB which are now called GRUB legacy. GRUB legacy is no longer being devel- oped and GRUB 2 has found its way to being the default boot loader being shipped with popular distributions like Ubuntu. GRUB 2 offers a lot of advantages over other boot loaders. GRUB 2 has a variety of built-in programs and commands that can be used to boot into various operating systems. It Figure 1. YaST Partitioner in Action recognizes filesystems of almost all Linux, Win- 14 linux identity set GRUB dows, Mac, BSD and Solaris systems. It is also possible to boot into a CD/ DVD image file like ISO using GRUB 2. It is also very customizable and gives you a choice to display background images. But before we look into the in- Figure 2. Disk Partitioning − Case 1 stallation of GRUB 2, let’s take a look at the various types of partitions. Partitioning Your hard disk can be divided into a number of separate portions that have their own identity. They are called Figure 3. Disk Partitioning − Case 2 partitions and are useful for installing operating systems as well as storing partitions (1) and (2) are reserved for Note: It is a good idea to in- data. There are two main types of par- MS Windows. The third primary parti- stall Windows before the Li- titions: primary and extended. A hard tion (3) can be used for shared data. nux distribution as it will replace the disk can be divided into a maximum It is a good idea to keep the shared MBR with its own entries. of four primary partitions or three pri- data as a primary partition so that it mary partitions and one extended. can be kept separate from the op- Booting (Cases 1 & 2) Primary partitions are easily boot- erating systems. To ensure that this In the above cases, there is a special able and are used to install operat- data can be accessed in all operat- way of installing the Linux distribu- ing systems. Extended partitions, on ing systems, you can choose Fat 32 tions. The boot loader of only one dis- the other hand can be divided into a or NTFS as the file system. tribution can be installed in the MBR. number of sub-partitions called logi- The remaining space is converted This distribution will be responsible cal drives. Logical drivers are usually into an extended partition (4). This for updating the boot loader configu- used to store data or install second- partition consists of six logical drives ration files. Whenever we install or ary operating systems. Partitioning (5 to 10). The first logical drive (5) is remove various kernels or distribu- can be achieved using GParted, YaST for the system swap. I have kept this tions, this activity has to be triggered. Partitioner (Figure 1) or a similar pro- as the first logical drive as one doesn’t This is because the main boot loader gram bundled with distributions in tend to introduce changes in the size will never know about the changes the DVD. It is a very good idea to first of the swap. The other drives are for made in other operating systems. resize and create the partitions and the various Linux distributions that Windows uses its own boot then install all operating systems. you shall install. The number of logical loader which is saved on the system Also you should label all your parti- drives may vary depending upon how partition or the System Reserved tions to avoid any confusion. many distributions you want to try. partition. However, for multi-booting One specific advantage of Linux Linux distributions, you shall have to distributions is that it can be in- Case 2 use the boot loader of one of the Li- stalled on primary partitions as well Installation on an empty hard disk. nux distributions. If you are installing as logical drives. There are various This case gives us the advantage Ubuntu as one of the distributions, ways of installing them based on of creating a partition table of our it is a good idea to install its boot your current partition table. Let us choice. Figure 3 shows a partition loader in the MBR. This is because see a few common cases in which table where I have installed Win- Ubuntu by default contains GRUB 2 our mission can be accomplished. dows (1) and one main Linux distri- which is our preferred boot loader. bution (2). While installing Windows, The boot loaders of the other distri- Case 1 I ensured that it is uses one partition butions must be installed on their re- Windows or another operating sys- only for its boot loader as well as spective logical drives containing the tem already installed on the comput- system files. I am resolving to retain root partition. Now your computer er. As we all know, Windows tends to these operating systems for a long will show you the GRUB 2 menu to occupy the first primary partition for time and hence they are on primary choose from all the existing OS. its system files. And some versions partitions. The primary partition (3) GRUB 2 installed by Ubuntu will of Windows (like Windows 7) also having a NTFS filesystem contains recognize the different kernels of the create a primary partition named shared data. The remaining space Linux distributions as well as other System Reserved for its normal work- has been converted into an extend- operating systems. However, it does ing. So we are usually left with one ed partition (4). Logical drive (5) is not check for them at every boot. Af- primary and one extended partition for Linux swap and is accessible for ter installation, GRUB 2 generates a for installing Linux distributions. all distributions. Logical drives (6) to grub.cfg file that contains this infor- Figure 2 shows the disk partition- (9) contain other distributions that I mation. This file is updated automati- ing map for case 1. Here, the first two may not retain in the long run. cally every time you install a new ker- www.linuxidentity.com 15 GRUB that the installation is successful. On entering the partition, you will see a directory /boot that contains neces- sary GRUB 2 files. When you reboot the computer, you will be taken to a GRUB prompt. You can easily enter Figure 4. Disk Partitioning − Case 3 any operating system directly by load- ing a kernel and using the boot com- nel in Ubuntu. But how will GRUB 2 systems. Note that all the Linux dis- mand. However it is recommended to know about the changes made in tributions were installed with the de- generate a grub.cfg file that shows a other distributions? There is a simple fault boot loaders in their respective menu at every system boot. command for this.