Skip to content

Instantly share code, notes, and snippets.

@staaldraad
Last active August 29, 2015 14:01
Show Gist options
  • Save staaldraad/9d010a82cd788db0698e to your computer and use it in GitHub Desktop.
Save staaldraad/9d010a82cd788db0698e to your computer and use it in GitHub Desktop.
Setup crypt container
#create new file to use as container
#dd if=/dev/zero of=/out count=5000k
fallocate -l 1G test.img
#create luks wrapper
cryptsetup -v -y luksFormat /out
cryptsetup luksOpen /out cryptname
cryptsetup -v status cryptname
#make into filesystem
mkfs.ext4 /dev/mapper/cryptname
#mount it
mkdir /media/mountpoint
mount /dev/mapper/cryptname /media/mountpoint/
##### To mount in the future.. ####
cryptsetup luksOpen /out cryptname
mount /dev/mapper/cryptname /media/mountpoint/
#check if mounted
df -H | grep cryptname
#### To safely dismount ####
umount /media/mountpoint
cryptsetup luksClose cryptname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment