I have some encrypted volumes that I use with my Xubuntu machine. One volume is a container file that is mapped to /dev/loop0 and encrypted using plain dm-crypt; another volume is a USB hard drive encrypted using dm-crypt/LUKS.

What I'd like to know is what would happen if I accidentally shut down the computer without unmounting and unmapping these volumes? Is it any more risky than if the volumes weren't encrypted?

Similarly, what would happen if I had to hard-reboot the machine without unmapping the volumes, because the system froze for example?

  • 1
    Vulnerable to what? – iyrin Mar 30 '15 at 1:25

The short answer is that encrypted volumes are not really more at risk.

The encrypted volumes have a single point of failure in the information at the beginning of the volumes that maps the password (or possibly several passwords for systems like LUKS) to the encryption key for the data. (That is why it is a good idea to encrypt a partition and not a whole disc, so that accidental partitioning doesn't overwrite this data).

This data does, AFAIK, not have to be updated unless one of the passwords changes, so the chances of it getting corrupted because a shutdown while it is half-written are low.

The rest of the disc is normally accessible with the encryption key retrieved from the above information block. Normal filesystem recovery is possible given that key.

You can make a backup of the LUKS header. But you have to realise that when you do and change one of the passwords later on (e.g. because it was compromised), that the backup "uses" the old passwords.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.