Skip to main content

Linux Dual Boot with Ubuntu and Debian. Ubuntu custom storage layout with LVM, Debian custom storage layout with LVM

481 words·
Linux Dual boot Ubuntu Debian GRUB

This Tutorial I’m setting up a dual-boot system with Ubuntu and Debian Linux. For both distributions I use a custom Logical Volume Management (LVM) storage layout.

Prerequisites
#

If you’re using a VM for the dual boot system, make sure to use UEFI bios.

With VMware Workstation the configuration looks like this:


Linux Dual Boot
#

Ubuntu Setup
#

  • Proceed with the Ubuntu Setup Wizard till you reach the “Guided storage configuration” and select “Custom storage layout”
  • Create a Swap Partition
  • Note: The Setup Wizard automatically creates the /boot/efi partition

  • Create empty partition for LVM

  • Create Logical Volume Group and select the empty partition
  • Create Logical Volume and mount it as /
  • Create another partition for the second OS, in this tutorial it will be Debian
  • Finish the setup
  • Reboot the server

Debian Setup
#

  • Boot from a Debian ISO and start the setup

  • Choose the “Graphical install”

  • Proceed to the “Partition disks” setup and select “Manual”
  • Select the empty partition
  • Define a name for the partition, for example “debian”
  • Use the partition as “physical volume for LVM”
  • Configure the Logical Volume Manager
  • Create a Logical Volume Group
  • Define a name for the Volume Group
  • Select the Physical Volume for the Volume Group
  • Create a Logical Volume
  • Select the Volume Group and create a Logical Volume
  • Define the name for Logical Volume
  • Choose the whole size of the Volume Group
  • Check the configuration details
  • Finish the LVM setup
  • Select the newly created Logical Volume
  • Create a Filesystem and define the mountpoint as /
  • Finish partitioning and write changes to disk
  • Finish the setup and reboot the server

GRUB Boot Loader
#

After rebooting the server both Linux distributions should be available in the GRUB boot menu.

If Debian is not available in the GRUB boot menu, for example if you installed it without LVM, proceed as follows:

  • Boot into the Ubuntu distribution
# Open the GRUB Configuration
sudo vi /etc/default/grub

# Add the following line, or set it to false if it already exists
GRUB_DISABLE_OS_PROBER=false

# Update the GRUB bootloader
sudo update-grub

# Shell Output
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.15.0-78-generic
Found initrd image: /boot/initrd.img-5.15.0-78-generic
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Debian GNU/Linux 12 (bookworm) on /dev/sda4
Adding boot menu entry for UEFI Firmware Settings ...
done
  • Reboot the server, Debian is now available in the boot menu.

Storage Layout
#

The final storage layout looks as follows:

lsblk

NAME                    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda                       8:0    0   100G  0 disk
├─sda1                    8:1    0     1G  0 part /boot/efi
├─sda2                    8:2    0   500M  0 part
├─sda3                    8:3    0    35G  0 part
│ └─vg_ubuntu-lv_ubuntu 253:0    0    35G  0 lvm  /
└─sda4                    8:4    0    35G  0 part
  └─vg_debian-lv_debian 253:1    0    35G  0 lvm