Dual boot

For about 10 years, I had a dual boot setup with Windows and Linux. I had Windows for occasional gaming, Linux for everything else. As gaming on Linux is finally a thing, as of 2025, thanks to Lutris and Proton, I don’t need Windows anymore.

Therefore, I decided to remove Windows and extend Linux disk partition.

Dual boot partitions setup

OS is Windows 11 and Fedora Linux 42.

My dual boot disk layout was following:

# lsblk
NAME                                          MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
zram0                                         251:0    0     8G  0 disk  [SWAP]
nvme0n1                                       259:0    0 953.9G  0 disk  
├─nvme0n1p1                                   259:1    0   100M  0 part  
├─nvme0n1p2                                   259:2    0    16M  0 part  
├─nvme0n1p3                                   259:3    0 487.4G  0 part  
├─nvme0n1p4                                   259:4    0   791M  0 part  
├─nvme0n1p5                                   259:5    0   512M  0 part  /boot/efi
├─nvme0n1p6                                   259:6    0     1G  0 part  /boot
├─nvme0n1p7                                   259:7    0    32G  0 part  [SWAP]
├─nvme0n1p8                                   259:8    0   100G  0 part  
│ └─luks-df5fe70c-6ec1-45d7-b698-2d2dfc80f9f0 252:0    0   100G  0 crypt /home
|                                                                        /

Partitions nvme0n1p1 - nvme0n1p4 belong to Windows, nvme0n1p5 - nvme0n1p8 belong to Fedora.

Remove Windows and extend Linux partition

  1. Remove all Windows partitions (by parted for example) and create a new partition instead
    # parted -a optimal /dev/nvme0n1
    GNU Parted 3.6
    Using /dev/nvme0n1
    Welcome to GNU Parted! Type 'help' to view a list of commands.
    

Print all partitions

(parted) p                                                                
Model: SAMSUNG MZVL21T0HCLR-00B00 (nvme)
Disk /dev/nvme0n1: 1024GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system     Name                          Flags
 1      1049kB  106MB   105MB   fat32           EFI system partition          boot, esp, no_automount
 2      106MB   123MB   16.8MB                  Microsoft reserved partition  msftres, no_automount
 3      123MB   523GB   523GB                   Basic data partition          msftdata
 4      523GB   524GB   829MB   ntfs                                          hidden, diag, no_automount
 5      524GB   525GB   537MB   fat32           EFI System Partition          boot, esp
 6      525GB   526GB   1074MB  ext4
 7      526GB   560GB   34.4GB  linux-swap(v1)                                swap
 8      560GB   668GB   107GB

Delete Windows partitions - partitions 1 - 4

(parted) rm 1                                                             
(parted) rm 2                                                             
(parted) rm 3                                                             
(parted) rm 4                                                             
(parted) p                                                                
Model: SAMSUNG MZVL21T0HCLR-00B00 (nvme)
Disk /dev/nvme0n1: 1024GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start  End     Size    File system     Name                  Flags
 5      524GB  525GB   537MB   fat32           EFI System Partition  boot, esp
 6      525GB  526GB   1074MB  ext4
 7      526GB  560GB   34.4GB  linux-swap(v1)                        swap
 8      560GB  668GB   107GB

Create a new partition and quit parted

(parted) mkpart primary 1 524GB                                           
(parted) p                                                                
Model: SAMSUNG MZVL21T0HCLR-00B00 (nvme)
Disk /dev/nvme0n1: 1024GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system     Name                  Flags
 1      1049kB  524GB   524GB                   primary
 5      524GB   525GB   537MB   fat32           EFI System Partition  boot, esp
 6      525GB   526GB   1074MB  ext4
 7      526GB   560GB   34.4GB  linux-swap(v1)                        swap
 8      560GB   668GB   107GB

(parted) q                                                                
Information: You may need to update /etc/fstab.

Make sure the Windows partitions are now gone and there is a new partition instead:

# lsblk
NAME                                          MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
zram0                                         251:0    0     8G  0 disk  [SWAP]
nvme0n1                                       259:0    0 953.9G  0 disk  
├─nvme0n1p1                                   259:1    0 488.3G  0 part  
├─nvme0n1p5                                   259:5    0   512M  0 part  /boot/efi
├─nvme0n1p6                                   259:6    0     1G  0 part  /boot
├─nvme0n1p7                                   259:7    0    32G  0 part  [SWAP]
├─nvme0n1p8                                   259:8    0   100G  0 part  
│ └─luks-df5fe70c-6ec1-45d7-b698-2d2dfc80f9f0 252:0    0   100G  0 crypt /home
│                                                                        /

Create LUKS container on the new partition:

# cryptsetup luksFormat /dev/nvme0n1p1
WARNING: Device /dev/nvme0n1p1 already contains a 'vfat' superblock signature.

WARNING!
========
This will overwrite data on /dev/nvme0n1p1 irrevocably.

Are you sure? (Type 'yes' in capital letters): YES
Enter passphrase for /dev/nvme0n1p1: 
Verify passphrase:

Get UUID of the LUKS container:

# cryptsetup luksUUID /dev/nvme0n1p1
e811aba7-ff57-4167-a4f3-3cc5184c4b5a

Open the LUKS container:

# cryptsetup open /dev/nvme0n1p1 luks-e811aba7-ff57-4167-a4f3-3cc5184c4b5a
Enter passphrase for /dev/nvme0n1p1:

Add the new partition with LUKS container to BTRFS:

# btrfs device add /dev/mapper/luks-e811aba7-ff57-4167-a4f3-3cc5184c4b5a  /
Performing full device TRIM /dev/mapper/luks-e811aba7-ff57-4167-a4f3-3cc5184c4b5a (488.26GiB) ...

Add record to /etc/crypttab:

luks-e811aba7-ff57-4167-a4f3-3cc5184c4b5a UUID=e811aba7-ff57-4167-a4f3-3cc5184c4b5a none discard

Add record to /etc/default/grub and regenerate initramdisk.
Append rd.luks.uuid=luks-e811aba7-ff57-4167-a4f3-3cc5184c4b5a to GRUB_CMDLINE_LINUX= line.

Optionally remove /boot/efi/EFI/Microsoft/ to not show Windows boot option.

Regenerate Grub config:

# grub2-mkconf -o /boot/grub2/grub.cfg

Links

  • Arch Linux Wiki - LUKS
  • Arch Linux Wiki - BTRFS
  • Fedora Docs - LUKS