If you repartition your device and forget to change the settings in conf.d/dmcrypt you might loose a lot of data. I have tried this on a 200GB ext4 partition. Fortunately fsck.ext4 could recover the data (I haven't activated the swap partition). What I'm asking for is a check like fdisk -l /dev/sda | grep /dev/sda10 | grep swap as I can't think of another usage of random keys except with swap-partitions.
*** Bug 289058 has been marked as a duplicate of this bug. ***
I just want to share some kind of workaround until this gets fixed: swap=crypt-swap source="$(fdisk -l /dev/sda | grep 'sda9' | grep -wq 'swap' && echo '/dev/sda9')"
fdisk only works on partitioned disks. it fails on files, loop setups, ...
*** This bug has been marked as a duplicate of bug 248495 ***