Change password for encrypted filesystem

If you have created encrypted partitions using cryptsetup you might change the password from time to time.
This can be achieved with following procedure:

Check which key slot is occupied (probably slot 0 if you have never done this)

cryptsetup luksDump /dev/sda#

Now you need to add a new key which will use the next free key slot:

cryptsetup luksAddKey /dev/sda#

Finally you can remove the previous key ( in this example slot 0):

cryptsetup luksKillSlot /dev/sda# 0

luksKillSlot requires a remaining password in another key slot to work.