Posts Tagged ‘secret’

encrypted file-partition

How to create:

dd if=/dev/urandom of=/home/user/.hide bs=1GB count=10
dd if=/dev/urandom of=/home/user/.keyfile bs=1KB count=2
losetup /dev/loop1 /home/user/.hide
badblocks -s -w -t random -v /dev/loop1
cryptsetup luksFormat /dev/loop1 -d /home/user/.keyfile
cryptsetup luksOpen /dev/loop1 secret -d /home/user/.keyfile
mkfs.ext4 -j /dev/mapper/secret
e2fsck -f /dev/mapper/secret

How to mount:

losetup /dev/loop1 /home/user/.hide
cryptsetup luksOpen /dev/loop1 secret -d /home/user/.keyfile
mount /dev/mapper/secret /mnt/hide/

How to umount:

umount /mnt/hide
cryptsetup luksClose secret
losetup -d /dev/loop1