Total Pageviews

Monday, 18 July 2022

Installing Debian Jessie with an LVM and Encrypted Swap and Root Partitions

 

Overview

The intent of this guide is to provide some direction when installing Debian with encrypted swap and root partitions, without using the default option provided by the installer for the installation of an encrypted LVM, which requires the entirety of the available disk to be used, and overwritten by extension.

The approach described below involves manually creating 2 physical partitions, one unencrypted 'boot' partition and one encrypted 'main' partition, with 'boot' and '' mount points respectively. The 'main' partition is used to form the swap and root logical partitions in the subsequently created LVM.

Assumptions

Some free space is available for the installation prior to running the installer, there are other guides which describe how to allocate this space.

Note

I'm using a VM in the illustrations, however the approach on a physical system should be predominantly indifferent.

Procedure

Upon reaching the 'Partition Disks' screen of the installer, select the 'manual' option:

r1VsnMn.png

Select the device you'd like to use for the installation:

usrke1i.png

Select yes within the subsequent prompt:

9aFGSuU.png

Upon returning to the partition overview, select the free space you've allocated for the installation:

ChsQDwe.png

Select 'Create a new partition':

amGFOEg.png

Enter a partition size of '0.1 GB', the recommended size of a boot partition [1], and select continue:

bm1EteT.png

Select 'primary' for the partition type:

PDlPwiS.png

Select 'Beginning' for the partition location:

fb7xscJ.png

Enter the settings show below, selecting '/boot' for the mount point of the partition, then select 'Done setting up the partition':

cbCuSMQ.png

Upon returning to the partition overview, select the remainder of the free space:

1QPcNHQ.png

Select 'Create a new partition':

iuCFlrs.png

For the size of the 'main' partition, enter the sum of the desired sizes of the swap and root partitions (in this example, a 0.5 GB swap partition with a 8 GB root partition is desired, thus 8.5 GB is entered for the partition size), and select 'Continue':

FfhvdJF.png

Select 'primary' for the partition type:

83KHDXM.png

Select 'Beginning' for the partition location:

fb7xscJ.png

Enter the settings show below, selecting '/' for the mount point of the partition, then select 'Done setting up the partition':

eSHvIJF.png

Upon returning to the partition overview, select 'Configure encrypted volumes':

kc1jhMB.png

When prompted to write changes to the disk, select 'Yes':

sebD0jr.png

Select 'Create encrypted volumes':

GQwDED6.png

When prompted to choose the partition (s) to be encrypted, select the 'main' (root) partition allocated earlier by hovering over the option and pressing space, subsequently selecting continue:

ga4Gjcn.png

When configuring the encrypted partition, the default options are deemed sensible, however it is the responsibility of the reader to ensure that the encryption settings suit their needs (see disclaimer at the top of this post), once the acceptability of the configuration has been verified, select 'Done setting up the partition':

imXTkMg.png

Select 'Finish':

y9jFaHS.png

When warned that the data in the partition will be erased as a result of the encryption, select 'Yes':

xp3dhcl.png

When prompted for an encryption passphrase, enter a strong phrase of your choosing (tips for creating strong passphrases available here [3]). Ensure that you <b>DO NOT FORGET/LOSE THIS PASSPHRASE</b>:

KZlZc4z.png

When prompted, re-enter your chosen passphrase:

IiGkcvz.png

Upon returning to the partition overview, select 'Configure the Logical Volume Manager':

8dfEQzz.png

When prompted to write changes to the disk, select 'Yes':

5gcRUIh.png

At the LVM configuration summary, select 'Create volume group':

3JbFcOy.png

Enter a name for the volume group and select 'Continue':

11oTciq.png

Exclusively select the encrypted partition created earlier to comprise the volume group, by hovering over the option and pressing space, before selecting 'Continue':

ZjtaGf8.png

Upon returning to the LVM configuration summary, select 'Create logical volume':

ttnGrOL.png

Select the volume group created earlier:

yuU7zbK.png

Enter a name for the logical volume, intended to be used for the swap partition, before selecting 'Continue':

2w1IkLy.png

Enter the desired size of the swap partition, and select 'Continue':

K7O53QX.png

Upon returning to the LVM configuration summary, select 'Create logical volume':

L6PgPHM.png

Select the volume group created earlier:

rFb4S8Y.png

Enter a name for the logical volume, intended to be used for the root partition, before selecting 'Continue':

ueUoGBg.png

Select 'Continue' to automatically use the remainder of the available space in the root partition:

Ro3lJQy.png

Upon returning to the LVM configuration summary, select 'Finish':

4G01fYu.png

Upon returning to the partition overview, select the logical swap partition created earlier:

KDbMZnI.png

Select the 'Use as' field:

ZUlOMLQ.png

Select the 'swap area' option:

EpYUM41.png

Select 'Done setting up the partition':

al8nZfv.png

Upon returning to the partition overview, select the logical root partition created earlier:

omfGxNX.png

Select the 'Use as' field:

KSvyWIl.png

Select the 'Ext4 journaling file system' option:

3TueYKE.png

Enter the settings show below, selecting '/' for the mount point of the partition, and subsequently selecting 'Done setting up the partition':

YzsKEGl.png

Upon returning to the partition overview, select 'Finish partitioning and write changes to disk':

cqZjigD.png

When prompted to write changes to the disk, select 'Yes':

F3teHdc.png

Upon completing the remainder of the installation process, and rebooting into the Debian installation, in order to reach the login screen, enter the chosen passphrase upon reaching the prompt:

9LqpwbB.png

Sources

[1] http://serverfault.com/questions/334663/what-is-the-recommended-size-for-a-linux-boot-partition, "What is the recommended size for a Linux /boot partition?", 2016. [Accessed: 7-Aug-2016].
[2] https://strongpasswordgenerator.com/, "Strong Password Generator", 2016. [Accessed: 7-Aug-2016].

from http://adlawren.github.io/blog/2016/08/07/installing-debian-jessie-with-an-lvm-and-encrypted-swap-and-root-partitions/

 

No comments:

Post a Comment