epcim
10/20/2015 - 9:51 AM

cryptsetup-luks-lvm.howto.md

cryptsetup, luks and LVM


sudo apt-get install lvm2
sudo fdisk /dev/sda

#create boot (512M) + sda2
sudo modprobe dm-crypt

# Overwrite the target partition with random junk and check for bad blocks
badblocks -v -w -t random $CRYPTPARTITION
sudo cryptsetup luksFormat -c aes-xts-plain64 -s 512 /dev/sda2
sudo cryptsetup luksOpen /dev/sda2 lvm_crypt
sudo vgcreate vg1 /dev/mapper/lvm_crypt
sudo lvcreate -n swap -L 8704M vg1
sudo lvcreate -n root -L 30G vg1
sudo lvcreate -n hg2g -L 300G vg1
sudo lvcreate -n reserve -l 100%FREE vg1 
sudo mkfs.ext4 /dev/mapper/vg1-hg2g -L hg2g
sudo mkfs.ext4 /dev/mapper/vg1-root -L root
sudo mkfs.btrfs /dev/mapper/vg1-reserve  -L reserve