1

I wish to install Linux with a full disk encryption except for the /boot and swap partitions using Luks. In order to keep storage expandable in the future, I opt for the Luks over LVM scheme. The problem is... how can I install Linux on a Luks-over-LVM during the installation process?

Assuming I use the following disk arrangement:

/dev/sda1 --> /boot
/dev/sda2, sda3 --> vg1 --> lv1 --> luks --> /
/dev/sda4 --> swap

I know how to create a Luks over LVM on an existing system, but just don't know how to put the system on it from the beginning.

Could someone point me to the right direction? Thank you!

  • Which distribution you installing? Some installers possibly support this out of the box. – sebasth Sep 22 '17 at 23:03
  • @sebasth I am using CentOS 7. Thank you for the answer and it was very mind opening. I will dig down further for details up to the first reboot. There are plenty tutorials for installing Linux on LVM-over-Luks or Luks alone, but not so much on the other way around. :-( – cody Sep 23 '17 at 13:43
  • I haven't installed CentOS in a while, but I think its possible to set up luks-on-lvm using the manual partitioning option in the installer. – sebasth Sep 23 '17 at 23:06
0

NOTE: I did not check if Debian installer supports setting up disks in way described in your example. This answer can be applied to other not directly supported configurations as well.

With Debian installer, you should be able to set up the disk layout from shell (Ctrl+Alt+F2). You need to have good understanding how your system works: if you configure disks outside of the installer, you also need to manually configure the installed system with the same parameters (crypttab, kernel modules, lvm, etc.).

The required LVM and LUKS modules need to be loaded by the installer, easiest way is following the installer to partitioning, select LVM and LUKS, then use <back> to navigate to installer menu. Switch to shell, set up your disks (and possibly filesystems), return to installer and select your created devices as install targets.

After install is complete, you should then verify that initramfs contains everything required to mount the root filesystem before rebooting from installer. You might need to create appropriate crypttab yourself, since the installer wasn't used to set up the encrypted devices.

Your new install is mounted to /target. Use chroot to get access to installed system tools. Initramfs contents can be listed with lsinitramfs <path to initramfs> and generated with update-initramfs -u -k all.


It is also possible to install a Debian system using debootstrap. Essential steps in short: Configure disks, mount devices (and /proc, /sys and /dev), debootstrap, install kernel and grub, configure the system (fstab, crypttab, kernel modules, etc), update-initramfs and reboot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.