As an alternative to using encrypted disk images, I created a FileVault 2 encrypted partition in Lion for some important data on the SSD in my MacBook Air. The password is not stored in a keychain. Once it is unlocked, I can unmount and mount it again without authenticating, even after logging out and back in again. Nothing short of restarting seems to lock this partition again.
Re-locking an internal encrypted partition while logged in is possible in other implementations of whole-disk encryption, and for FileVault 2, according to the man page for diskutil, specifically, for the command diskutil coreStorage unlockVolume
,
"This verb unlocks an LVF by providing that authentication; as the LVs are thus appear
as dev nodes, any file systems upon them are automatically mounted. To "re-lock" the
volume, make it offline again by ejecting it, e.g. withdiskutil eject
"
While this does work as it should with encrypted external drives, it does not seem to work on my encrypted internal partition. I can eject the logical volume, which is /dev/disk1, but it does not get locked. Trying to eject its containing Logical Volume Family, Physical Volume, or Logical Volume Group, results in errors, even using administrator privileges. I tried variations, using unmount, unmountDisk, referring to the device UUIDs, with no luck. What am I doing wrong here?