Linux Format

Grub explained Dual-boot Linux...............

Afnan Rehman dives deep into the world of dual-boot systems to bring you the simplest solution to the two OS problem.

- is a student, Linux tinkerer and general computer geek who breaks everything first so you don’t have to. Afnan Rehman

Get more than one OS living on your hard drive, we’re avoiding that ‘W’ word…

We live in a world where multiple operating systems hold a share of the desktop market and applicatio­ns aren’t always available on every platform that you want them to be, it’s often necessary to have more than one OS available ready to boot. Virtual machines offer only a partial solution to this problem as do compatibil­ity layer technologi­es such as Wine. The solution is to dual-boot two OSes on the same machine.

The boot managers of modern day OSes can manage multiple systems and allow the user to choose which one to boot at startup. This way you can have Windows OS and a Linux distro, so that you can keep the beautiful experience that is Linux while also accessing applicatio­ns that still only work well on for work or play. (Not every game supports SteamPlay on Steam for Linux, although we’re getting closer). In this tutorial, we’ll focus specifical­ly on dual-booting a Linux distributi­on (distro) with Windows. We will be using Ubuntu. However, the steps in this tutorial can be adapted to other Linux distros.

First, let’s talk a little bit about why we dual boot. There are many reasons people pursue a dual-boot solution, the key reasons being performanc­e and compatibil­ity. As most users will tell you, it’s best to run things natively with access to the computer’s hardware resources. The fact is, virtual machines will severely restrict the amount of resources that you can use. When you implement a dual-boot system, you’re able to boot as if Linux is the main OS and Windows weren’t there and vice versa. That gives you access to all the processing cores, all system RAM and all expansion cards that the computer has to offer, making it easy to run intensive programs without slowdown. You also get access to all disks and externally connected devices such as USB devices at full speeds (as long as the OS supports them, of course).

How dual-booting works

For the sake of brevity, we will assume you are able to install Windows without a detailed explanatio­n. It’s safe to say that if you’ve ever installed a Linux distro, you are more than ready to install Windows on your own. If you’re a newcomer to Linux – welcome! – and you’re likely to have Windows installed on your current system (given that the Windows family still has around 90% of the market) and can proceed directly to creating a dual-boot system as a fresh reinstall of Windows isn’t required. If you haven’t tried installing Windows before, the process is simple and there are many guides online to help you. The installati­on media is usually sold on a disk or USB drive and can be often purchased online or in store. Once you insert the media and boot the computer, a series of steps will guide you through the installati­on.

The version of Windows that you choose to install shouldn’t matter, whether it’s Windows 7, 8 or 10. The type of

program that’s used to get the system started after turning it on, either legacy BIOS or EFI boot, may matter in some cases but on most modern systems this won’t cause any major issues. Let’s get some basic terminolog­y out of the way.

EFI stands for Extensible Firmware Interface, and most modern system partitions are in this format, which adheres to the UEFI (Unified Extensible Firmware Interface) standard. UEFI replaces the Basic Input/Output System (BIOS) that most PC devices used before. This is important mostly for more advanced users who wish to manually set partitions for more customised setups. Since most modern systems use UEFI, we’ll work on the assumption that you will too.

Each hardware manufactur­er has a different implementa­tion of UEFI and each has its own unique quirks. Most have the same basic functions and structure, which allow for the installati­on of different operating systems. However, Different UEFIs can manifest major problems for some and instant success for others. Different button settings, boot menus, and startup sequences can cause problems when you are trying to mess with the boot sequence. It’s best to research your manufactur­er’s UEFI manual beforehand and familiaris­e yourself with the settings before you try to change anything. Most system boot sequences will feature a splash screen where you can press a function key to gain access to boot settings menus (for example, it’s F9 for HP, F12 for Dell and Lenovo, F8 in Amibios and F11 in an Award BIOS) and you’ll need to know which key it is to open which menus and which settings to change. Knowing these things beforehand can save you a lot of headache should the need for troublesho­oting arise.

Partition standards

You’ll also hear the acronyms GPT and MBR thrown around. These terms relate to how partitions in the hard drive are organised and recorded. MBR, which stands for Master Boot Record, refers to the informatio­n stored in the first sector or partition of the hard drive that identifies how and where an operating system is located so that it can be loaded into the computer’s main storage or RAM.

GPT, which stands for GUID Partition Table, is similar in function to MBR in that it stores partition informatio­n for the hard drive. This informatio­n includes where the partition starts and ends so that the OS knows which sectors belong to which partition and which ones are bootable. MBR, which was first introduced back in 1983, can only handle drives that are up to 2 terabytes in size and can support up to four partitions per drive. GPT is a newer standard that has been gradually replacing MBR and handles drives that are far larger and allows for a nearly unlimited amount of partitions. If you have Linux the GRUB bootloader, which handles OS booting just like the Windows boot loader, is often stored in the MBR or GPT. It’s important to note that Windows can only boot a GPT drive on a UEFI-based machine. All current versions of Windows, Linux and Mac OSX support GPT and it’s generally recommende­d to use this scheme on any new installs for the sake of compatibil­ity and to avoid issues that MBR might bring.

There are benefits and drawbacks to either installing Windows or Linux first and every system is different. In this guide, we will be taking you through the process having Windows installed first. It’s possible to install Ubuntu first, but there are far fewer issues when having Windows installed first, as the Linux GRUB bootloader can adapt easily to accommodat­e Windows. In contrast, the Windows bootloader will almost always disregard the presence of another existing OS, often overwritin­g the existing bootloader and rendering the other OS useless until it’s repaired.

It’s important to note that while most of Linux distros are good at handling dual-boot situations, there’s always room for something to go wrong. We highly recommend performing a backup of any existing data to a separate storage device just in case the worst happens. Any files, settings or applicatio­ns can be backed up in a variety of ways that will allow you to pick and choose what to save for later. It would be best to save this backup on a separate physical device, such as a different hard drive, a different computer or possibly cloud storage if you have enough space and a fast enough connection. The simplest way to back up everything you need to back up is to make a recovery disc which will back up Windows itself and set up a File History backup to take care of

personal files. There are wizards located in the Control Panel that will guide you through both of these backup processes. The recovery disc will help you restore Windows system and boot files in case something goes wrong with the operating system. File History will automatica­lly back up personal files to a designated device in case the worst comes to pass and your entire drive partition gets corrupted.

Now that you understand the basics, let’s get to work. The first thing you’ll need to do is choose your distro of Linux that you want to install. For this tutorial, we’re using Ubuntu 16.04. The most important thing you will need to start is a copy of Ubuntu live CD on a USB flash drive or compact disc. You can download your preferred version of Ubuntu from its website at www.ubuntu.com/download. Here you can download an ISO file that you can use to create a DVD or bootable USB flash drive. We recommend creating a bootable flash drive as it’s more versatile than a DVD, especially with optical drives getting phased out of many newer systems to save space, weight and power. Once you have a flash drive made you can move on to getting your partitions in order to prepare for the installati­on.

Of course, now you will only be able to resize the Windows partition if there’s a decent amount of available space on it, so make sure you have room before you commit to undertakin­g this project. If your computer is running multiple hard drives you also have the option of installing Linux on an entirely different drive, leaving your Windows partition untouched. Now before you run out and purchase a brand new hard drive, I’ll remind you that the two installati­ons are perfectly capable of running in harmony on different partitions of the same physical drive.

Partitioni­ng methods

There are a few ways to handle partitioni­ng, so I’ll explain the one that assumes you have Windows already installed. If you already have Windows installed, the easiest method is to just use the diskpart utility built into Windows to help with this process. Every drive is different, and it’s likely you’ll have multiple partitions already existing on the hard drive, such as recovery, OEM and primary etc. Be careful resizing or deleting these partitions as messing with the wrong one will lead to major issues. Usually, the partition labelled ‘Primary’ is the largest and is where most of your files and data are held. Any partitions labelled ‘System’ or ‘OEM’ should not be modified at all, as those hold Windows system files and cannot be changed, lest you risk the entire system being corrupted. The Primary partition could be resized to give you space for your Linux installati­on. The easy way to do this is to go into the Disk Management applicatio­n, find your drive with the primary Windows installati­on, right-click the partition and select ‘Shrink Volume’. After that, just follow the onscreen instructio­ns and you’re good to go. Now you’ll see a section of the drive with a black bar above it labelled as ‘Unallocate­d’. This is where your shiny new Linux installati­on will go. Alternativ­ely, if you’re feeling brave you can lose any partition named ‘Recovery’ and install there. However, make sure you know what you’re getting yourself into when you do this.

Now, you can restart and boot from a USB or disk into the Ubuntu live CD by holding down the Shift key while rebooting. On booting, hit the appropriat­e function key to load up the boot menu, where you can select which device to boot from. Find your flash drive and hit the Enter key to commence the boot process. You’ll be loaded into the Ubuntu live CD environmen­t with its basic feature set. Here, you can start the installati­on process.

Now follow the onscreen instructio­ns to install Ubuntu. Make sure to choose options that would allow for the Ubuntu install to exist alongside the existing Windows installati­on. Don’t try to overwrite it, because that would be disastrous. This step will involve you as the user deciding how much space to allocate for your Linux installati­on. You’ve already set aside space for the Ubuntu installati­on in Windows Disk Management, but you also have the option to use more or less space depending on how you want to do things. In Ubuntu, there are two ways to install alongside Windows. First, there’s an option labelled ‘Install Ubuntu alongside Windows’ which will handle everything for you. Some other Linux distros, such as those using Calamares installer, offer similar options to simplify the process. Otherwise, you can also make and resize partitions using the installer. If you choose this route, you can select ‘Something Else’ when prompted for installati­on type. You can resize the partitions based on your needs and use case. If you’re mainly using Linux to experiment, you may not need as much space as if you were, for example, heavily invested in Linux gaming or dealing with other large amounts of data. Make sure that the boot loader remains the Windows Boot Manager.

The installati­on process itself will vary depending on the Linux distro that you want to use. For Ubuntu, the process is a fairly simple step-by-step walkthroug­h. You can choose to install updates during the installati­on, however, you can skip this if you have a poor internet connection or just want to install them later. At the very end, you’ll be asked to restart.

At this point, you’re done and can start using your Ubuntu Install. Switching between OSes would involve a simple reboot. When booting you’ll be given the option to load either Windows or Ubuntu, usually with a default option that will automatica­lly boot after several seconds. If you’re not receiving these options, try some basic troublesho­oting by retracing your steps.

Sometimes you may find that you need to remove the Linux install for whatever reason. When removing Linux from

the dual-boot process you must be very careful so as not to break your bootloader and, in turn, create a massive headache and possibly render the Windows install unusable.

Removing Linux

To start, you’ll need your Windows installati­on or recovery CD or an Ubuntu live DVD. To remove the GRUB bootloader, open the command prompt from the installati­on or recovery media environmen­t. Next, type: > bootrec /fixmbr

Reboot and boot into Windows. Then move onto using the Ubuntu live CD. Boot from the CD and choose Boot-Repair. If it isn’t installed then you can try to install through a few simple terminal commands that you can type one by one: $ sudo add-apt-repository ppa:yannubuntu/boot-repair $ sudo apt-get update $ sudo apt-get install boot-repair

Next, simply boot-repair and click the ‘Recommende­d Repair’ option.

Last, to remove the Ubuntu partitions you’ll need to head back into Windows, reboot and boot into Windows and open Disk Management by searching for it in the Windows menu. In disk management, right click the Ubuntu partitions and select ‘Delete’. This is the point of no return so make sure you’re good to go before you click that button. If you plan to just keep using Windows then right click the Windows partition and select ‘Extend Volume’. This will increase the size of the Windows partition to fill up the free space. That should be all that is needed to restore the machine to using only one operating system.

Now that you know how to add and remove operating systems to and from a computer in a dual-boot situation, you are ready to tackle your own project with other distros and combinatio­ns. As a final note, there’s also the possibilit­y of adding more OSes to your boot sequence, creating tripleboot or multi-boot systems. Adding systems essentiall­y follows the same basic steps of partitioni­ng and adding as space allows to the hard drive. With more operating systems comes more versatilit­y and using the bootloader to your advantage can allow you to truly make your computer your own and design an environmen­t suited to your needs.

 ??  ?? The shrink volume dialog box in Disk Management allows you to shrink a partition size, and also warns you if your desired shrinkage is too small.
The shrink volume dialog box in Disk Management allows you to shrink a partition size, and also warns you if your desired shrinkage is too small.
 ??  ?? The diskpart tool allows you to accomplish partitioni­ng and storage tasks with a command line interface for more advanced users and those who might wish for more custom settings.
The diskpart tool allows you to accomplish partitioni­ng and storage tasks with a command line interface for more advanced users and those who might wish for more custom settings.
 ??  ??
 ??  ?? The Disk Management tool provides an easy to understand graphical interface for partitioni­ng and managing storage on all disks that the OS has access to.
The Disk Management tool provides an easy to understand graphical interface for partitioni­ng and managing storage on all disks that the OS has access to.
 ??  ??
 ??  ?? The Ubuntu live environmen­t allows you to try Ubuntu right off of the disc, so you can use it to test some features and prepare your machine before writing anything to disk.
The Ubuntu live environmen­t allows you to try Ubuntu right off of the disc, so you can use it to test some features and prepare your machine before writing anything to disk.
 ??  ?? The manual partitioni­ng tool in the Ubuntu installer is similar to many partitioni­ng GUI tools.
The manual partitioni­ng tool in the Ubuntu installer is similar to many partitioni­ng GUI tools.

Newspapers in English

Newspapers from Australia