Dual Boot Windows / Linux + LVM + LUKS
Dual Boot Windows / Linux + LVM + LUKS
I’ll be using Slackware in this example, but this layout is common in Linux and I’ve used it for Arch, Alpine, Fedora, Centos, Void and others.
Preparation:
It’s handy to have one USB stick for each OS or distro you want to install. They’re cheap as dirt and most ISOs will fit on 8GB, and many a great deal less.
- you can make one by downloading a slackware iso (Current or 14.2) or whatever distro you’re going to install.
sudo dd if=/path/to/iso/file of=/dev/sdx status=progress
- (sdx is the usb stick –> you’ll want to make sure you get this part right)
- Windows users should make your bootable windows iso on a windows box. You can make a bootable slackware iso using rufus at the same time.
Partitioning
- I find it easier in Linux, so I’ll use my Slackware installer stick to boot up.
- Windows 10 - in my experience, Windows 10 is activated by a unique hardware key present on your device. Thus wiping a drive with W10 pre-installed shouldn’t affect your license. It’s up to you to confirm.
-
Boot Slackware USB
-
Use
cfdisk
orgdisk
to partition the drive with 3 partitions:- make one 600MiB type Linux
- NOTE - some distros like Centos and Fedora want an efi partition and a boot partition. In this case I make two Linux paritions of 256MiB and 600MiB
- make one big partition of type Linux (about half the drive, to your preference)
- make one big partition of type Windows (yup, the other half)
- write to disk and exit
mkfs.ext4 [ALL (2 or 3) Linux partitions]
- NOTE - We’re just doing this to trick windows into ignoring the partitions we will use for Linux
mkfs.fat -F 32 [the Windows partition]
- make one 600MiB type Linux
-
Reboot using Windows USB and install windows. It should only see the FAT32 partition, and will reformat it NTFS etc. It will NOT infiltrate the ext4 partitions.
-
Reboot Slackware USB
-
Use
cfdisk
orgdisk
to:- set the 600MiB partition to EFI (type ef00)
- NOTE - some distros like Centos and Fedora want an efi partition and a boot partition. In this case set the 256MiB to efi (ef00) and the 600MiB to Linux (8300)
-
Format the EFI partition, e.g. /dev/sda1
mkfs.fat -F 32 /dev/sda1
-
Now let’s say the big Linux partition is /dev/sda2
-
NOTE - of course just replace “xxx_name” placeholders with your own
-
swap size is your discretion
-
the slackware installer will default to the first efi it finds
- also see below or tricking the installer to avoid putting slackware boot files on your windows partition
cryptsetup luksFormat /dev/sda2 cryptsetup luksOpen /dev/sda2 crypt_name pvcreate /dev/mapper/crypt_name vgcreate vg_name /dev/mapper/crypt_name lvcreate vg_name -L 8GiB vg_name -n swap lvcreate vg_name -l 50%FREE vg_name -n slackroot_name lvcreate vg_name -l 50%FREE vg_name -n otherroot_name mkswap /dev/vg_name/swap swapon /dev/vg_name/swap mkfs.ext4 /dev/vg_name/slackroot_name mount /dev/vg_name/sysroot /mnt mkdir /mnt/boot mount /dev/sda1 /mnt/boot
-
-
Type
setup
to get going with your Slackware install and select the partitions in the installer -
The slackware installer
setup
is self-explanatory, except for multiple boot systems. It looks for an EFI boot partition, formatted FAT 32, and will use the first one it finds. This is a problem if you have another Linux or Windows install already there. I don’t like to share /boot partitions between distros and certainly not with Windows. But there’s a workaround:mount your / partition to /mnt mkdir /mnt/boot/efi mount your desired /boot partition to /mnt/boot/efi
- start the installer
setup
and go through the first steps including selecting the partitions - BEFORE installing the software, return to the terminal
[ctl]-[alt]-[F2]
and see if the slack installer has mounted a /boot/efi partition it shouldn’t have - unmount
umount
the incorrect /boot/efi partition but leave the correct one mounted - return to the installer
[ctl]-[alt]-[F7]
and proceed with install - it will use the mounted /boot/efi partition
- start the installer
-
You’ll be given a choice to install
LILO
(not used on EFI systems) orELILO
- I prefer
GRUB
– if you go this route skip ELILO - otherwise install it and proceed
- I prefer
-
Either way, once the install is done,
[esc]
from the installer but do not restart!- correct /etc/fstab so the /boot/efi partition points the one you wanted (sdx#)
- ELILO configuration tips are here
- GRUB configuration tips are here