Installing Windows & Linux Dual Boot System
Ever found yourself torn between the sleek, user-friendly experience of Windows and the robustness and open-source allure of Linux? Fret not, for you can have the best of both worlds with a seamless dual-boot setup. In this comprehensive guide, we'll walk you through the intricate process of installing Windows and Linux on the same machine, unlocking a realm of endless possibilities and flexibility.
Imagine being able to seamlessly transition between operating systems, harnessing the power of Linux for development, server management, or simply embracing its customizable nature, while still having access to the familiarity and compatibility of Windows for daily tasks or gaming. With a dual-boot configuration, you'll no longer have to compromise; instead, you'll wield the ultimate computing experience tailored to your needs.
But installing a dual-boot system is no mere child's play; it requires meticulous planning, attention to detail, and a deep understanding of partitioning and boot management. Fear not, for this guide will hold your hand every step of the way, from crafting a bootable USB drive to meticulously dividing your disk space and configuring boot options.
So, buckle up and prepare to embark on a journey that will transform your computing paradigm, empowering you with the versatility and freedom to harness the capabilities of both Windows and Linux on a single machine. Get ready to unlock a world of endless possibilities and unleash your true potential as a power user.
1. Preparation Work
1.1 Creating a Bootable USB Drive
Prepare a USB drive with 8GB or more capacity (4GB is sufficient). Back up any data on the drive as it will be formatted.
Next, go to the Ubuntu official website and download the desired ISO image file, typically Ubuntu 18 or Ubuntu 16. If you're not comfortable with English, you can use the Chrome browser which will automatically translate the webpage.
- https://www.ubuntu.com/download/desktop // Download links for Ubuntu 18.04.2 and 19.04
- http://releases.ubuntu.com/?_ga=2.132932682.518720393.1557799252-856679875.1557799252 // Other mirror download links
Next, create the bootable USB drive using the Rufus tool.
After downloading Rufus, open it, select the downloaded ISO file, and it will automatically set the parameters. Click "Start" and wait for the process to complete.
If you see any prompt messages, select the default option.
Detailed instructions are also available on the official website. Here's the link. If the link is broken, you can find it on the official website under the download section.
1.2 Allocating Disk Space
Allocate a portion of your computer's hard drive for Ubuntu installation.
Press Windows + X and select "Disk Management," or right-click on "My Computer" > "Manage" > "Disk Management."
Select a drive other than C: that has sufficient free space (100GB or more). If possible, choose the last drive letter (E: if you have C, D, and E drives; F: if you have C, D, E, and F drives). Right-click on the drive and select "Shrink Volume." Enter the desired amount of space you want to allocate for the Ubuntu system. You can revisit this step later after learning about Ubuntu partitions and decide on the appropriate space allocation based on your needs.
In my case, I had plenty of free space, so I allocated 600GB. You can see a 600GB independent space that will be assigned to Ubuntu later.
2. Installing Ubuntu
Insert the bootable USB drive you created earlier into your computer and press the hotkey during boot to enter the boot menu. You should see a prominent "Ubuntu" boot option; select it.
You'll then see the Ubuntu boot screen, followed by several options. The first two options are likely "Try Ubuntu" and "Install Ubuntu." Select "Install Ubuntu."
Prepare for the installation. If you have an internet connection, it's recommended to check the option to download updates.
Next, select the installation type. Choosing "Erase entire disk" will erase your existing Windows system, so select the "Something else" option to perform manual partitioning.
You should see several partitions on this screen, including the free space you allocated earlier.
2.1 Partitioning
Now, let's discuss partitioning. Partitioning involves dividing your free space into several sections, each with its own responsibilities.
Ubuntu Linux can mount partitions as directories. For a typical hard drive size (500GB-1000GB), the recommended directory allocation is as follows:
Directory | Suggested Size | Format | Description |
---|---|---|---|
/ | 150GB-200GB | ext4 | Root directory |
/tmp | Around 5GB | ext4 | System temporary files, typically not saved after a system restart. (Required for server setup?) |
/boot | Around 1GB | ext4 | System boot starting location. Recommended: Should be larger than 400MB or 1GB. Linux kernel and boot system program files, such as vmlinuz and initrd.img, are located in this directory. In general, the GRUB or LILO system boot manager is also located here. Boot files location, such as kernels, initrd, and grub. |
/home | As large as possible | ext4 | User working directory; personal configuration files, such as environment variables; each account is assigned a working directory. |
swap | Twice the physical memory | Swap space | Swap space: Similar to "virtual memory" in Windows. If you have low memory (1-4GB), allocate twice the physical memory. For higher memory (8-16GB), set it equal to the physical memory or physical memory + 2GB. |
/tmp is optional, and /boot can be 1GB. The root directory (/) and /home should be allocated more space, from tens to hundreds of gigabytes, depending on your needs. When allocating space, it's best to allocate other partitions first and then allocate the swap space.
2.2 Partitioning Demonstration
Select your free space and click the "+" sign. First, allocate space for /boot.
There's a recommendation for dual-boot systems: If your computer already has a primary partition-type boot loader, you can choose the "Logical Partition" for /boot. For a completely blank disk, /boot should be set as a "Primary Partition." I haven't tried both methods, but this should be correct.
However, if you have a completely blank disk, you don't need to partition manually. You can simply choose the "Erase entire disk" option at the beginning.
Special Note: This article was written later, and I didn't save screenshots from when I installed Ubuntu. The images in this section are taken from someone else's blog, where they allocated only 300MB for /boot. My recommendation is still to allocate 1GB.
Click "+" again to allocate other partitions. The partition type should be "Logical Partition," and the location should be the starting position of the free space. For the partition sizes, you can follow my suggestions in the table below the red text.
When allocating the swap space, remember to change the "Use as" option to "Swap Space."
2.3 Installation
After partitioning is complete, prepare for the installation.
Select the partition corresponding to /boot for the "Device for boot loader installation." Confirm the details and click "Install."
Next, you'll go through some simple locale and language selections and create a user account. I won't cover those steps here.
Wait for the installation to complete...
After the installation is finished, you can check the partitions in Windows:
3. Modifying Boot Options
After installing the dual-boot system, your computer may still default to booting into Windows. If you want Ubuntu to be the default boot option, you'll need to modify the boot order.
In the Windows system, download the EasyBCD tool. Here's a link if it's no longer available, you can search for it online.
Link: https://pan.baidu.com/s/1slPiDZ3 Password: z3r7
Move the system you want to boot as the default to the top of the list.
Uninstalling the Windows+Linux Dual Boot System
The following content is based on a post from http://tieba.baidu.com/p/4485862313?see_lz=1.
The post was visible a few days ago (as of May 14, 2019, 3:21:39 PM), but it suddenly disappeared. Fortunately, I found the Baidu cached version.
This section covers uninstalling Linux while keeping Windows (applicable to UEFI+GPT systems). For dual-boot installation, you can refer to https://blog.csdn.net/fanxueya1322/article/details/90205143.
1. Delete Ubuntu Partitions in Windows
Press Windows + X to open Disk Management.
Windows is the key that looks like a flag next to the Alt key.
These are the partitions I created when installing Ubuntu. Right-click and delete each volume.
Restore the free space. In my case, I had originally shrunk the D: drive to create this 600GB space for Ubuntu. Select the D: drive, right-click, and select "Extend Volume" to restore it to its original size.
2. Removing Boot Entries
After deleting all Ubuntu partitions and rebooting, the GRUB interface is still present, but attempting to boot into Ubuntu fails. Next, you'll need to remove Ubuntu's boot files.
If you use the easyUEFI software to view the EFI boot entries, you'll find that Ubuntu has written its EFI boot files to the Windows EFI boot partition.
If you only want to remove the boot files, you don't need to download easyUEFI. It's just used to view the boot entries.
Here's how to remove the boot entries:
2.1 Mount the EFI Partition
- Right-click on the Windows icon and select "Command Prompt
(Admin)"
- Type "diskpart" and press Enter
- Type "list disk" to list all disks in the system
- Type "select disk 0" to select the disk containing the EFI boot
partition (adjust the disk number based on your system)
- Type "list partition" to list all partitions on the selected
disk
- Type "select partition 1" to select the EFI boot partition (the
partition type should be "System")
- Type "assign letter=p" to assign a drive letter to the selected partition (use an available letter)
2.2 Using Total Commander
After mounting the EFI partition, you should see a new drive (P:) in My Computer, but you won't have access permissions. Even running as an administrator won't grant you access. What can you do?
We'll use a software called Total Commander. Search for it online, download, and install it. After installation, open the program (it's free for personal use) and follow the prompts.
Once open, select the P: drive.
Run Total Commander as an administrator.
Navigate to the EFI folder.
Select the Ubuntu folder (it should turn red), then press Shift + Delete to delete it.
Done!