When I upgraded to Yosemite, the installer offered to painlessly switch my hard drive to use FileVault 2 full disk encryption. I said yes.
Unfortunately, the OS didn’t generate the recovery key that it was supposed to. I was left with an encrypted disk, and no recovery key I could file away in case I forgot my password.
After some investigation, I discovered that you can ask OS X to create a new recovery key for you from the command line. In a Terminal window, type:
sudo fdesetup changerecovery -personal
You’ll need to enter your password for sudo, then the
fdesetup utility will prompt you again with:
Enter a password for '/':
Enter your password again. The fdesetup utility will then create and display your new personal recovery key.