create luks lvm partition

  1. lvcreate -L 500M -n crypto cryptovg
  2. Fill your partition with random data:

    dd if=/dev/urandom of=/dev/
    cryptovg
    /crypto
  3. initialize your partition:

    cryptsetup --verbose --verify-passphrase luksFormat /dev/
    cryptovg
    /
    crypto
  4. open the newly encrypted device:

    cryptsetup luksOpen /dev/
    cryptovg
    /
    crypto cryptosec
  5. check it’s there:

    ls -l /dev/mapper | grep cryptosec
  6. create a filesystem:

    mkfs.ext4 /dev/mapper/cryptosec
  7. mount it:

    mount /dev/mapper/cryptosec /media/cryptosec
  8. check it’s visible:

    df -h | grep
    cryptosec
  9. add the following to /etc/crypttab:

    cryptosec
    /dev/
    cryptovg
    /
    crypto
     none
  10. edit your /etc/fstab, removing the old entry for /dev/cryptovg/crypto and adding

    /dev/mapper/
    cryptosec
    /media/
    cryptosec
    ext4 defaults 1 2
  11. restore default SELinux security contexts:

    /sbin/restorecon -v -R /media/
    cryptosec
  12. reboot:

    shutdown -r now
  13. The entry in /etc/crypttab makes your computer ask your

    luks

    passphrase on boot

  14. Login as root and restore your backup

1 thought on “create luks lvm partition

  • Hrmm that was weird, my comment got eaten. Anyway I wanted to say that it’s pleasant to be aware that someone else furthermore mentioned this as I had trouble finding the same info elsewhere. That was the first spot that told me the answer. Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *

*


Hit Counter provided by laptop reviews