In this tutorial I will show you how to have several Linux operating systems (OS) on the same computer.

Table of Contents

These instructions are valid for UEFI systems.

When a computer boots in UEFI mode, first looks up for a bootloader in the EFI partition (which is created during installation of the first OS). This bootloader has a list of installed OS, so you can choose one.

Installing a Linux OS with another Linux OS.

For this tutorial, I’ve installed Ubuntu Server 20.04 as the first system (using default configuration without LVM).

Ubuntu Server disk selection

The disk partition schema after installation is:

Disk /dev/vda: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 84F36EAF-34B5-4402-9D0C-287D68BBE538

Device       Start       End   Sectors  Size Type
/dev/vda1     2048   1050623   1048576  512M EFI System
/dev/vda2  1050624 104855551 103804928 49.5G Linux filesystem

Resizing file system and partition

For this step we will need a live USB system, because we need to unmount the Linux filesystem partition. As I’m going to install Linux Mint, I will use it. Make sure your system will boot from the USB.

It’s recommended that you back up the data inside partition you want to resize. Then, using Live system, unmount partition if it’s mounted.

It’s possible that you don’t need to use “sudo” on your Live system if you are a root user on it.

  1. Check filesystem.
    # Replace with your system partition path
    sudo e2fsck -f /dev/vda2
    
  2. Resize filesystem.
    # Replace partition path and new size
    sudo resize2fs /dev/vda2 15G
    
  3. Open fdisk.
    # Replace with your hard disk path
    sudo fdisk /dev/vda
    
  4. Delete system partition.
    # Make sure which partition you want to delete, you can type "p" to see a partition list
    Command (m for help): d
    Partition number (1,2, default 2): 2 
    -
    Partition 2 has been deleted
    
  5. Recreate the partition with the new size.
    # Replace with your partition number and new size
    Command (m for help): n
    Partition number (1,2 default 2): 2
    First sector (1050624-104857566, default 1050624):
    Last sector, +/-sectors or +/-size{K,M,G,T,P} (1050624-104857566, default 104857566): +15G
    -
    Created a new partition 2 of type 'Linux filesystem' and of size 15GiB.
    Partition #2 contains a ext4 signature
    -
    Do you want to remove this signature? [Y]es/[N]o: N
    
  6. Create a new partition
    Command (m for help): n
    # Accept the defaults
    
  7. Save changes
    Command (m for help): w
    
  8. Format the new partition
    # Replace with your new partition path
    sudo mkfs.ext4 /dev/vda3
    
  9. Reboot from your hard disk and make sure everything works.

Installing the new system

I’m going to install Linux Mint 20.2 as the second OS. In this case, where “Installation type” window appears, check “Something else” and then “Continue”. This window appears: Linux Mint installation window

Click on the new partition and select “Change”. Select “Ext4 journaling system” under “Use as:” and type “/” under “Mount point:”. You can check “Format partition”. Linux Mint select partition window

In “Device for boot loader installation”, select your EFI partition.

Once installed, reboot your computer, this window will appear and you will be able to select your OS: GRUB window

Installing Arch Linux as the third system because, why not?

I’m going to install Arch because its installation process is a bit more complicated.

  1. Run Arch from a USB.
  2. Follow Arch Linux Installation Guide.
  3. The resizing section is the same as in Mint (without using “sudo”).
  4. Mount your new partition on /mnt.
    # Replace with your new partition path
    mount /dev/vda4 /mnt
    
  5. Mount your EFI partition on /mnt/boot.
    # Replace with your EFI partition path
    mkdir /mnt/boot
    mount /dev/vda1 /mnt/boot
    
  6. When you reach Bootloader section, follow these steps.
    • Install these packages.
      pacman -S grub efibootmgr os-prober
      
    • Install GRUB.
      grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
      
    • Mount system partitions of other OS.
      mkdir /mnt/ubuntu
      mkdir /mnt/mint
      mount /dev/vda2 /mnt/ubuntu
      mount /dev/vda3 /mnt/mint
      
    • Edit /etc/default/grub and add/uncomment this line:
      GRUB_DISABLE_OS_PROBER=false
      
    • Create the main configuration file.
      grub-mkconfig -o /boot/grub/grub.cfg
      
    • Command output will show a list with all OS installed.
  7. On Arch, you may need to install networkmanager in order to have Internet access after installation.
    pacman -S networkmanager
    
    # After reboot
    systemctl enable NetworkManager
    systemctl start NetworkManager
    

Installing Linux with Windows

In this section, we are going to install a Linux OS on a Windows computer. I’m going to install Manjaro XFCE 21.1.2 on a Windows 10 computer.

It’s recommended that you disable Fast Startup and Hibernation on Windows (Control Panel -> Power Options -> Choose what the power buttons do -> Change settings that are currently unavailable, then under “Shutdown Settings” uncheck “Turn on Fast Startup” and “Hibernate”, and click “Save Changes”).

Resizing partition

  1. On Windows, open “Disk Management”. Disk Management main window
  2. Select data partition (C:\, NTFS-formatted), right-click and select “Shrink Volume…”.
  3. In “Enter the amount of space to shrink in MB”, type amount of MB to shrink, and click “Shrink”. Disk Management shrink volume window
  4. Click on Unallocated space, right-click and select “New simple volume”.
  5. Press “Next” until “Assign Drive Letter or Path” window appears. Select “Do not assign a drive letter or drive path”. Click “Next”.
  6. Check “Do not format this volume” and click “Next”. Click “Finish”.

If you cannot shrink the volume more than you want, try this:

  1. Disable system restore (Settings -> System -> About -> System info -> Advanced system settings).
  2. Defragment windows partition (Settings -> search “Defragment and Optimize Drives”).

Installing new system

  1. Now you can boot your Linux ISO image.
  2. Start installation process.
  3. When “Partitions” window appears, select “Manual partitioning”. Manjaro partitions window
  4. Select the new partition and click “Edit”.
  5. Select “Format” and select “ext4” under “File System”.
  6. Select “/” under “Mount Point”, click “OK”. Manjaro edit partition window
  7. Select your EFI partition (FAT32 formatted) and click “Edit”.
  8. Check “/boot/efi” under “Mount Point”. Check that “boot” flag is selected and “Keep” is selected in “Content”. Click “OK”.
  9. Click “Next”.
  10. If a “No EFI system partition configured” window appears, ignore it.
  11. After installation, reboot and this window will appear where you can select your OS: Manjaro boot menu

Optional: create a shared partition

You can create a partition to share files between Windows and your Linux OS. Windows does not detect filesystems created with Linux, and using the Windows partition on Linux could become your Windows system unusable if you change file permissions or remove system files by mistake.

We are going to format the new partition as NTFS. In order to mount NTFS partitions on Linux, you may need to install ntfs-3g package.

  1. You can create the partition with Linux (using fdisk, gparted, etc.) but you need to create the NTFS filesystem with Windows (using their Disk Manager utility).
  2. Created a folder in Linux to mount the partition (e.g.: /mnt/shared-partition).
  3. Add the partition to /etc/fstab to mount it at boot time.
    # An example of /etc/fstab line
    UUID=4ECCA1C4CCA1A725 /mnt/shared-partition ntfs rw,nouser,auto,noexec 0 0
    
    • You can view filesystem UUID by running lsblk -o name,uuid.
    • You can change mount properties to suit your needs.

I recommend you to create a folder inside your new filesystem and add files there (e.g.: /mnt/shared-partition/files) because The filesystem root will have some Windows folders that it’s better to not touch.

Installing Windows as your first OS: some considerations

If you are going to install Windows on a blank drive, its installation medium will create three partitions: EFI, MSR and “Primary” (where Windows will be installed). EFI partition will have only 100MB, and if you are planning to install more OS, this partition will fill up quickly.

  1. To increase EFI partition size, you need to click “Repair system” after selecting your language in the Windows Setup. Then, press “Trubleshoot” and “Command Prompt”. Windows install first window Windows install advanced options menu
  2. Inside the command prompt, type diskpart and press Enter.
  3. Type list disk to see all disks attached. Windows diskpart list disk command
  4. Select the disk with select disk and its number (0, 1,…). Windows diskpart select disk command
  5. You can type list partition to see if there are partitions on the disk. If you want to delete them, type select partition and the partition number and then type delete partition (type delete partition override if you can’t delete a partition).
  6. Type convert gpt to create a GPT disk, if it has MBR partition style.
  7. To create new partition, we are going to start with EFI. Type create partition efi size= and the partition size (in MB). My minimum recommended size is 200MB but 500MB is a good choice.
    create partition efi size=500
    
  8. Create MSR (Microsoft Reserved) by typing: create partition msr size=16 (16MB is the standard size for this partition).
  9. Type create partition primary to create the Windows partition. If you don’t add the size parameter, it will use all the remained space. To add a Recovery partition, you need to add the size parameter with a size that leaves at least 500MB for the Recovery partition.
  10. Add a Recovery partition after Windows partition. Type create partition primary. Then, type set id de94bba4-06d1-4d40-a16a-bfd50179d6ac to set the partition as a Recovery partition. Windows diskpart all partition created
  11. Finally, type exit to close “diskpart” and exit again to close the command prompt. Then, select “Shutdown PC” and boot you computer from the installation medium again to start the installation process. It will show you the four partitions. Windows install partitions menu

If you have any suggestion, feel free to contact me via social media or email.