Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I have a partition like /dev/hd1 that is unencrypted and want it to be encrypted, but want to keep everything currently in that partition, how can I do that?

share|improve this question
nope, not without intermediate storage...this question has been discussed before – RobotHumans Nov 30 '10 at 20:52
up vote 4 down vote accepted

There does not seem to be an solution to do that in place. Truecrypt offers the system encryption only for windows, dm-crypt overwrites partitions. Your best bet would be to move everything from that partition into a backup with cp -a, create an encrypted partition with luks/dm-crypt and move everything back.

share|improve this answer

Since this comes up near the top of google results, adding solution:

LUKS in place encryption via

share|improve this answer

Actually you can convert from a plain filesystem partition to dm-crypt.

But it's risky and cumbersome.

There is an out-dated tutorial here:

Dm-crypt maps one block to one block, so in theory it is doable. Luks is a user-friendly container that uses dm-crypt inside it. A luks partition contains a header and a dm-crypt partition inside it, where the encrypted filesystem really lives.


  1. If you choose to go Luks then your task is even harder, and you will need to know exactly how much ahead the dm-crypt data should be with respect to the begining of the official partition.

  2. In any case, if your system crashes or halts during the procedure you loose your data

More references:

share|improve this answer

This is trivial if you choose plain dm-crypt. It's risky - if it fails part-way through (power cut or whatever) then you're stuffed!

Ensure the raw device isn't mounted then create an encrypted device for it and use dd to copy from the raw device to the encrypted one:

$ cryptsetup open /dev/sda sda-crypt --type plain
$ dd if=/dev/sda of=/dev/mapper/sda-crypt bs=512

The plaintext data is read from /dev/sda and written to the device mapper, /dev/mapper/sda-crypt, which encrypts it and writes it back to /dev/sda, overwriting the plaintext data that was read.

It will likely take some time due to it reading and writing the entire disk.

share|improve this answer
How do you then mount? – jdborg Mar 24 at 23:39
you mount mount /dev/mapper/sda-crypt /mnt or whatever mount-point you need. Of course, you must unlock /dev/sda first, as shown above. – starfry Mar 25 at 10:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .