Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 04-12-2012, 06:41 PM   #1
LQ Newbie
Registered: Jul 2003
Location: Pennsylvania
Distribution: Arch Linux
Posts: 10

Rep: Reputation: 0
LVM and LUKS Question

I want to make sure that I've correctly configured my system to install Linux on a fully encrypted disk (minus /boot). I'm using LVM on LUKS - both of which I've got very little experience with. Here's what I did:

First, I created two partitions.

/dev/sda1 (100mb. I'll use this for /boot)
/dev/sda2 (Rest of disk. This is the LVM Container)
I then encrypted /dev/sda2:

cryptsetup -c aes-xts-plain -y -s 512 luksFormat /dev/sda2
I opened the LUKS partition:

cryptsetup luksOpen /dev/sda2 container
So, now I have:

I setup my logical volumes:

pvcreate /dev/mapper/container
vgcreate VolGroup00 /dev/mapper/container
lvcreate -L 20G VolGroup00 -n root
lvcreate -C y -L 10G VolGroup00 -n swap
lvcreate -l +100%FREE VolGroup00 -n home
created filesystems:

mkfs.ext4 /dev/VolGroup00/root
mkswap /dev/VolGroup00/swap
mkfs.ext4 /dev/VolGroup00/home
and mounted them:
swapon /dev/VolGroup00/swap
mount /dev/VolGroup00/root /
mount /dev/VolGroup00/home /home
Does this look correct? Did I miss anything?
Old 04-12-2012, 07:53 PM   #2
Registered: Oct 2009
Location: Leander, TX
Distribution: Fedora 20
Posts: 97

Rep: Reputation: 35
It looks correct as far as I can tell, however when I set up a LUKS partition, I do it the opposite way. In other words I create the logical volume / use luksFormat to open that logical volume as a seperate device in /dev/mapper, and then format that with ext4 (or whatever).

The important difference is that creating a the encrypted volume on top of the logical volume allows me to initially set the pv properly to type 8e, though your method may allow more flexibility in resizing the volumes. (I've never tested your method though.) I've written a few blog entries on this topic (to include automounting LUKS) here:

Edit: Both methods should work, see discussion here:

Last edited by roger_heslop; 04-12-2012 at 08:00 PM.
1 members found this post helpful.
Old 04-13-2012, 02:31 PM   #3
LQ Newbie
Registered: Jul 2003
Location: Pennsylvania
Distribution: Arch Linux
Posts: 10

Original Poster
Rep: Reputation: 0
Thanks for your advice and the links, Roger. Your blog is a helpful resource for someone new to LUKS such as myself.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] LUKS and LVM on two separate drives jjthomas Slackware - Installation 3 07-01-2010 11:39 AM
Luks/Lvm after dd duplication brodo Slackware 10 03-12-2009 04:56 PM
New kernel and existing Luks/Lvm ? brodo Slackware 3 09-14-2008 10:44 AM
Slackware 12.1, LUKS, LVM on external HD. How? randomsel Slackware - Installation 7 06-26-2008 07:35 PM
luks cryptsetup and lvm question ruzzed Linux - Software 3 09-16-2007 08:21 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:27 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration