<p>Thisconfigurationdoesleave<code>`/boot'</code> vulnerable, however I do not have anything particularly important there (if you do you may want to look up how to use LVM on LUKS with <code>`/boot'</code> in an encrypted partition, I believe the ArchWiki has an page on this). I will continue to show you how to setup your configuration so that you can have a similar config (such as adding a <code>`/home'</code>partitionorotherwise).</p>
<p>Iwillstartassumingyou've already booted from the Parabola live CD (the main one, not the MATE one). I will also assume that the device you'reinstallingtois<code>`/dev/sda'</code>, <b>please make sure you'reusingthecorrectdevice!</b>.LastthingIwantisane-mailsayingthatmypostcausedsomeonetodeleteanimportantdriveorsomething.</p>
<p>Tobeginwillmostlikelywanttosecureyourdiskandassurethatnoinformationisleftbehindonitbyoverwritingtheentirething.Youcandothisbyrunning<code>`dd if=/dev/urandom of=/dev/sda bs=1M status=progress'</code>. You can use <code>`/dev/zero'</code> instead as the <code>`if'</code>,butbewarethatif<code>`dd'</code> misses anything then it will be evident that that block of information was not wiped and is relevant. This will take a while, so go make a coffee, go out for a walk, read a book, do something else for a while. I ran this on a 500GB mechanical hard drive and it took about an hour, you can approximate by looking at the progress information (the parameter of which I so generously provided, <code>`status=progress'</code>,unlikemostotherguides)anddecidewhattodo,ifyouhaveanSSDitmaytakelesstime.</p>
<p>Onceyou've come back for the hundredth time to finally see that it finished we can now begin with the partitioning. First, you'llwanttorun<code>`cfdisk /dev/sda'</code> (you can use whatever you want, that's just what I used) and choose the <code>`dos'</code> disk label (others may work, but <code>`dos'</code>iswhatIused,and<code>`gpt'</code> failed horribly for me). After this create a new primary partition of about 100M, Linux, and set the bootable flag for it (from now on it will be referred to as <code>`/dev/sda1'</code>, same warning as before). Then allocate the rest of the space (or whatever you want) to a second primary partition which will be our LUKS encrypted LVM partition, make sure it'saLinuxLVMtype(fromnowonitwillbereferredtoas<code>`/dev/sda2'</code>,again,pleasemakesure).Afterwhichwritethechangesandexittheprogram.</p>
<p>Firstlet's get the boot partition out of the way. You only need to run <code>`mkfs.ext4 /dev/sda1'</code>(orext2ifyouprefer,butext4worksforme).</p>
<p>Nowit's finally time to get to the encryption. First make sure the kernel module is enabled: <code>`modprobe dm-crypt'</code>.Nowyou'll want to run a benchmark to see which encryption algorithm will work best with your computer, seeing that certain CPUs favor certain algorithms. You can see this by running <code>`cryptsetup benchmark'</code>.Itislikelythataes-xtswillbethebestoptioninyourcasewithacertainkeysize.Youcannowrun<code>`cryptsetup --cipher <your-cipher-type> -s <key-size> luksFormat /dev/sda2'</code>. If indeed the best algorithm for your CPU is aes-xts then you can ignore the <code>`--cipher<your-cipher-type>'</code> argument, since it will use that by default, otherwise please refer to the docs or man pages. After this your <code>`/dev/sda2'</code>partitionshouldbeformattedwithLUKS.We'rehalfwaythere!</p>
<p>Nowthatyouhavetheencryptedpartitionit's time to open it ('causerightnowit's closed), and by open I just mean decrypt it, it will not be mounted (yet). Run <code>`cryptsetup luksOpen /dev/sda2 <label>'</code>.For<code>`<label>'</code> you can put anything you want, I put <code>`lvmcrypt'</code> just to make it clear as to what it is (and that'showI'll refer to it in the rest of this post). Now you should be able to find the partition (or, rather, a link to your partition) in <code>`/dev/mapper/'</code>withthelabelyoujustgaveit,andyoucantreatitjustlikeanyotherpartition,whichiswhatwe'lldoforgettingLVMsetuponit.ThefollowingwillbealistofcommandstosetupLVMwithrootandswaplogicalvolumes:</p>
<pre>
# Load kernel module
modprobedm-mod
# Setup LVM
pvcreate/dev/mapper/lvmcrypt
# Create the LVM group I use VolGroup0
vgcreateVolGroup0/dev/mapper/lvmcrypt
# Create the swap partition
lvcreate-Cy-L4GVolGroup0-nlvolswap
# Create root partition with the rest of the space
lvcreate-l+100%FREEVolGroup0-nlvolroot
</pre>
<p>Atthispointallthepartitionsshouldbecreatedandavailablein<code>`/dev/mapper/'</code> with names like <code>`VolGroup0-lvolswap'</code> (or whatever you put for the group and volume names). These are the volumes we'llbeworkingwith.Simplyrun:</p>
<pre>
mkfs.ext4/dev/mapper/VolGroup0-lvolroot
mkswap/dev/mapper/VolGroup0-lvolswap-Lswap
</pre>
<p>Orhoweveryouwantedtoformatthem.</p>
<p>Fromthispointonyoucanmountthemhoweveryou'd like according to the Parabola installation guide. The only thing you need to be careful of is when it comes time to setup the kernel hooks and the GRUB settings. When it comes time to setup the hooks you'llwanttoyour<code>`/etc/mkinitcpio.conf'</code> <code>`HOOKS'</code> variable to look something like this: <code>`HOOKS="base udev autodetect modconf keyboard block encrypt lvm2 filesystems fsck"'</code>.Themainhooksherethatyou<b>need</b>are<code>`keyboard'</code>, <code>`encrypt'</code>, and <code>`lvm2'</code>(theorderthey're in compared to the other hooks <b>is important</b>). You'llalsowanttomodifyyour<code>`/etc/default/grub'</code> to have the <code>`GRUB_CMDLINE_LINUX_DEFAULT'</code> variable look something like <code>`GRUB_CMDLINE_LINUX_DEFAULT="quiet splash cryptdevice=UUID=<luks-uuid>:lvmcrypt"'</code>,where<code>`<luks-uuid>'</code> is the UUID of your LUKS partition which you can find via looking at the symbolic links in <code>`/dev/disk/by-uuid/'</code>.</p>
<p>Ifyouhaveaswappartitionthenyouwillwanttoadda<code>`resume'</code> flag and hook to the prior. To do this in <code>`/etc/default/grub'</code> change it the variable to look like <code>`GRUB_CMDLINE_LINUX_DEFAULT="... resume=/dev/mapper/VolGroup0-lvolswap"'</code>,andchangethehooksin<code>`/etc/mkinitpcio.conf'</code> to look like <code>`HOOKS="... encrypt lvm2 resume ..."'</code>.Withthishibernationshouldworkjustfine.</p>
<p>Whenyoufinishmakingthechangesmakesuretorun<code>`mkinitcpio -p linux-libre'</code> and then for GRUB run <code>`grub-mkconfig-o/boot/grub/grub.cfg'</code>.</p>
<p>Afteryou're done with all of the configuration and are exiting you'llhavetoproperlyunmountthevolumesandclosetheencrypteddevice.TodothisstartbyunmountingthevolumesaswouldtypicallydowheninstallingParabola,andthenrunthefollowing:</p>