http://jootamam.net/howto-basic-cryptsetup.htm http://www.finnie.org/2009/07/26/keyfile-based-luks-encryption-in-debian/ http://sleepyhead.de/howto/?href=cryptpart sudo cryptsetup isLuks /dev/vdb sudo cryptsetup -y luksFormat /dev/vdb --key-file /tmp/mykey.txt sudo cryptsetup --key-file /tmp/mykey.txt luksOpen /dev/vdb backup ubuntu@dm-crypt:~$ lsblk -o KNAME,TYPE,SIZE,MODEL KNAME TYPE SIZE MODEL vda disk 30G vda1 part 30G vdb disk 4G ubuntu@dm-crypt:~$ lsblk -d -n -oNAME,RO | grep '0$' | awk {'print $1'} vda vdb http://www.bogotobogo.com/DevOps/AWS/aws_attaching_Amazon_EBS_volume_to_instance.php ubuntu@dm-crypt:~$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT vda 253:0 0 30G 0 disk └─vda1 253:1 0 30G 0 part / vdb 253:16 0 4G 0 disk ubuntu@dm-crypt:~$ sudo file -s /dev/vdb sudo: unable to resolve host dm-crypt /dev/vdb: data ubuntu@dm-crypt:~$ sudo file -s /dev/vda1 sudo: unable to resolve host dm-crypt /dev/vda1: Linux rev 1.0 ext4 filesystem data, UUID=50879377-446a-412a-99bf-e0d42a78c1b3, volume name "cloudimg-rootfs" (needs journal recovery) (extents) (large files) (huge files) ubuntu@dm-crypt:~$ sudo mkfs -t ext4 /dev/vdb sudo: unable to resolve host dm-crypt mke2fs 1.42.9 (4-Feb-2014) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 262144 inodes, 1048576 blocks 52428 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=1073741824 32 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done ubuntu@dm-crypt:~$ sudo file -s /dev/vdb sudo: unable to resolve host dm-crypt /dev/vdb: Linux rev 1.0 ext4 filesystem data, UUID=a6e166a8-7b98-4f61-8318-6ba4b878bfee (extents) (large files) (huge files) ubuntu@dm-crypt:~$ sudo mkdir /mydisk sudo: unable to resolve host dm-crypt ubuntu@dm-crypt:~$ sudo mount /dev/vd /mydisk vda vda1 vdb ubuntu@dm-crypt:~$ sudo mount /dev/vdb /mydisk sudo: unable to resolve host dm-crypt ubuntu@dm-crypt:~$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT vda 253:0 0 30G 0 disk └─vda1 253:1 0 30G 0 part / vdb 253:16 0 4G 0 disk /mydisk7379716029 http://unix.stackexchange.com/questions/52078/how-to-mount-a-cryptsetup-container-just-with-mount #!/bin/bash set -e if [[ $(mount | grep ${2%%/} | wc -l) -gt 0 ]]; then echo "Path $2 is already mounted!" >&2 exit 9 else MAPPER=$(mktemp -up /dev/mapper) cryptsetup luksOpen $1 $(basename $MAPPER) shift mount $MAPPER $* || cryptsetup luksClose $(basename $MAPPER) fi