Instructions
- First, create your disk image file.
- The below will create a 10GB file as /root/encrypted
[root@MyShinyServer /]# dd if=/dev/zero of=/root/encrypted bs=1M count=10k
- Set up the loopback for it
[root@MyShinyServer /]# losetup /dev/loop0 /root/encrypted
- Create an encrypted mapping for the device:
[root@MyShinyServer /]# cryptsetup -v –key-size 256 luksFormat /dev/loop0
- Verify the encryption worked with:
[root@MyShinyServer /]# cryptsetup -v luksDump /dev/loop0
- Open the encrypted device
- This will create a mapping device at /dev/mapper/encrypted.
[root@MyShinyServer /]# cryptsetup luksOpen /dev/loop0 encrypted
- Put a filesystem on it
[root@MyShinyServer /]# mkfs.ext3 /dev/mapper/encrypted
- Mount it
[root@MyShinyServer /]# mkdir /mnt/encrypted
[root@MyShinyServer /]# mount /dev/mapper/encrypted /mnt/encrypted