Skip to content

Rage Against the Shell

Linux tips and other things…

  • Home
  • Contact
  • Privacy Policy

LVM Encryption with Luks

Posted on September 1, 2015 - April 24, 2016 by Mr. Reboot

First create the logical volume:

~ $ lvcreate -L100G -n lv01 vg0

Now create the encrypted volume, you will be asked for the master password, it’s very important you save it safely.

~ $ cryptsetup -y -v luksFormat /dev/vg/lv01

Open the encrypted volume, is mapping to /dev/mapper:

~ $ cryptsetup luksOpen /dev/vg/lv01 clv01

Show the status:

~ $ cryptsetup -v status /dev/mapper/clv01
/dev/mapper/clv01 is active.
  type:    LUKS1
  cipher:  aes-cbc-essiv:sha256
  keysize: 256 bits
  device:  /dev/mapper/vg-lv01
  offset:  4096 sectors
  size:    2147479552 sectors
  mode:    read/write
  Command successful.

To see the headers on the encrypted partition:

~ $ cryptsetup luksDump /dev/vg/lv01

It’s advisable writing zeros to the disk, be patient with a huge disk:

~ $ dd if=/dev/zero of=/dev/mapper/clv01

Format the file system with the desirable format:

~ $ mkfs.ext4 /dev/mapper/clv01

Mount device, for example in /mnt/DATA:

~ $ mount /dev/mapper/clv01 /mnt/DATA/

Unmount device safely:

~ $ umount /dev/mapper/clv01
~ $ cryptsetup luksClose /dev/mapper/clv01
Posted in File systems

Post navigation

Change mysql root password
Real IP on nginx behind a proxy

Search

Calendar

September 2015
M T W T F S S
 123456
78910111213
14151617181920
21222324252627
282930  
« Aug   Oct »

Categories

  • Apache
  • Cisco
  • Command line
  • Distros
  • Dovecot
  • File systems
  • Gadgets
  • GlusterFS
  • MySQL
  • Nginx
  • NTP
  • Opendkim
  • Pacemaker + Corosync
  • Postfix
  • Raspberrypi
  • SSH
  • SSL
  • Varnish

RSS RSS

  • Using qrencode January 16, 2022
  • Compile varnish module vmod_vsthrottle April 22, 2020
  • SSH vpn with sshuttle April 9, 2020
  • Disable swap in systemd December 16, 2019
  • Getting the parent process pid October 12, 2018
Proudly powered by WordPress | Theme: micro, developed by DevriX.