This could be a great alternative if you have used TrueCrypt encrypted volumes.
I’ve been a TrueCrypt lover for a long time, even after it was allegedly killed. But now I’m starting to think that it’s not a good option for long term safekeeping of my memories. At time point in a future release of Linux if dependencies for TrueCrypt stop working that’s death to my archives. Fortunately we have LUKS since 2004! After using LUKS for a couple of years I think it’s very reliable.
Now, it’s time to replace TrueCrypt volumes with LUKS disk images. I experimented with a 512 MB virtual disk and it worked like a charm. Here are my steps in a basic example (Ubuntu).
- Create an empty virtual disk
dd if=/dev/zero of=/home/shaakunthala/luksvolume1 bs=1M count=512
- Format/ encrypt it with LUKS
cryptsetup -vy luksFormat /home/shaakunthala/luksvolume1
You will be asked to provide a passphrase.
- Open the new encrypted container
sudo cryptsetup luksOpen /home/shaakunthala/luksvolume1 myluksvol1
This will prompt for the passphrase.
- Format it
sudo mkfs.ext4 /dev/mapper/myluksvol1
- Mount
sudo mount /dev/mapper/myluksvol1 /mnt
If you are using Ubuntu, you will be see a removable device icon. Without using the command line, you can alternatively use it to do one-click mount/ unmount.
- Unmount and Close
sudo umount /mnt && sudo cryptsetup luksClose myluksvol1
In case of an abnormal shutdown/ power failure while using the encrypted volume,
- Open the encrypted container
sudo cryptsetup luksOpen /home/shaakunthala/luksvolume1 myluksvol1
- File system check
sudo fsck /dev/mapper/myluksvol1
- Mount and etc. then close.
Now, just create one big as you want, mount and then copy your files. Don’t forget to unmount and properly close the encrypted volume once you are done with your work every time.
[…] Yesterday I wrote about How to create an encrypted LUKS disk image. […]
[…] Create a new LUKS volume, but with a different passphrase to keep your LUKS headers. Header file size is usually 1.1 MB, so a 32 MB image should be enough for most regular users. […]
[…] How to create an encrypted LUKS disk image – Shaakunthala’s Miniblog […]
[…] How to create an encrypted LUKS disk image – Shaakunthala’s Miniblog […]