Way to encrypt disk without formatting it

disk-encryptionencryptionluks

When I was installing my OS, I didn't encrypt. Is there a way to encrypt it now without formatting and without losing any data?
I read a few guides how to encrypt and every one says that I need to backup all my data because I will lose it.
Is there a way to encrypt it all now without losing data?

Best Answer

From the LUKS faq https://gitlab.com/cryptsetup/cryptsetup/wikis/FrequentlyAskedQuestions#2-setup

2.5 Can I encrypt an already existing, non-empty partition to use LUKS?

There is no converter, and it is not really needed. The way to do
this is to make a backup of the device in question, securely wipe the device (as LUKS device initialization does not clear away old data),
do a luksFormat, optionally overwrite the encrypted device, create a
new filesystem and restore your backup on the now encrypted device.
Also refer to sections "Security Aspects" and "Backup and Data
Recovery".

For backup, plain GNU tar works well and backs up anything likely to be in a filesystem.*

However you may want to look into https://johndoe31415.github.io/luksipc/usage.html#plain-to-luks-conversion "Plain to LUKS conversion" which could satisfy your requirement. Disclaimer : I've never tried this, I don't know if it works, and the project doesn't appear to have been updated since 2015.

Related Question