Encryption with DM-Crypt

May 21, 2011 00:00 · 47 words · 1 minute read Linux

Create container

dd if=/dev/zero of=/home/user/container bs=1M count=200000
losetup /dev/loop0 /home/user/container
cryptsetup -c aes-xts-plain create data /dev/loop0
mkfs.xfs -l internal,size=128m -d agcount=8 /dev/mapper/data

Usage:

losetup /dev/loop0 /home/user/container
cryptsetup -c aes-xts-plain create data /dev/loop0
mount -o noatime,nodiratime,logbufs=8 /dev/mapper/data /mnt/data

Umount container:

umount /mnt/data
cryptsetup remove data
losetup -d /dev/loop0