These instructions from howtoforge.com got me up and running with an automatically decrypting volume.
How to: Automatically Unlock LUKS Encrypted Drives With A Keyfile
Step 1: Create a random keyfile
sudo dd if=/dev/urandom of=/root/keyfile bs=1024 count=4
Step 2: Make the keyfile read-only to root
sudo chmod 0400 /root/keyfile
That will make the keyfile readable only by root. If someone get access to this keyfile, then you have a bigger problem on your computer anyway.
Alternatively chown your desired keyfile to root:root and move it into the /root folder
Step 3: Add the keyfile to LUKS
LUKS/dm_crypt enabled devices may hold up to 10 different keyfiles/passwords. So, next to having the already setup password we're going to add this keyfile as additional authorization method.
sudo cryptsetup luksAddKey /dev/sdX /root/keyfile
sdX is of course your LUKS device.
First you'll be prompted to enter an (existing) password to unlock the drive. If everything works well, you should get an output like this:
Enter any LUKS passphrase:
key slot 0 unlocked.
Step 4: Create a mapper
LUKS devices need to create a mapper that can then be referenced in the fstab. Open /etc/crypttab
sudo nano /etc/crypttab
and add then a line like this:
sdX_crypt /dev/sdX /root/keyfile luks
or you can use the UUID of the device:
sdX_crypt /dev/disk/by-uuid/247ad289-dbe5-4419-9965-e3cd30f0b080 /root/keyfile luks
sdX_crypt is the name of the mapper that is being created. You can use here any name e.g. "music" or "movies" or "sfdsfawe" ....
Save and close the file by issuing ctrl-x, enter, enter. Ctrl-x closes nano but first it asks to save the file [yes = enter] and what the name shall be [same name = enter].
What we have done there actually is telling that /root/keyfile shall be used instead of password entry to unlock the drive.
Step 5: Mount the device in fstab
Now, we have an unlocked device (well, not yet but when the system is being booted up) and we just need to mount it now. Open /etc/fstab:
sudo nano /etc/fstab
and add a new entry like:
/dev/mapper/sdX_crypt /media/sdX ext3 defaults 0 2
Make sure you have the correct mapper name that you added in step 4. Also make sure that the mount point/folder exists. After having added it, save again the file and close it (ctrl-x, enter, enter).
Step 6: Reboot or remount
That's it. Now you can reboot and the additional devices should be auto-unlocked and mounted. You can also test it by remounting all devices:
sudo mount -a