Sam Stelfox

Thoughts from a software engineer, systems hacker and Linux gubernāre.


Recommended / Best Practices

Creating an LVM partition

Create a Physical Partition

Create Physical LVM Volume

pvcreate /dev/sdc1 (assuming /dev/sdc1 was the partition just created)

Volume Group Creation

This point needs a bit of thinking before doing. There is a limit on the number of physical extents that can be accessed. This in turn limits the size of the volume group. This limit is 65,536 extents.

The default size is 4MB/extent. This by default leads to a limit of 256GB per volume group. 8MB/extent gets you 512GB. The maximum size I see needing is 32MB/extent for a size of 2TB. The following example uses an extent size of 16MB and assumes the partition is /dev/sdc1.

vgcreate -s 16M vg_test /dev/sdc1

Logical Volume Creation

The following creates a 1GB logical volume group, there does not seem to be a way to create a logical volume with all the remaining space in the volume group.

lvcreate -L 1G -n lv_test vg_test

Securing Partitions

Encrypting Additional Partitions

cryptsetup luksFormat -c aes-xts-plain -s 256 -h sha256 /dev/vg_test/lv_test
cryptsetup luksOpen -c aes-xts-plain -s 256 -h sha256 /dev/vg_test/lv_test \
mkfs.ext4 /dev/mapper/cryptTest
cryptsetup luksClose /dev/mapper/cryptTest