Can I create a new ext4
encrypted partition with kernel 4.1 on Ubuntu 15.04?
Ubuntu – How to create ext4 encrypted partition on Ubuntu 15.04 with new 4.1 kernel
15.04encryptionext4
15.04encryptionext4
Can I create a new ext4
encrypted partition with kernel 4.1 on Ubuntu 15.04?
Best Answer
First off a disclaimer: I've not done this with Ubuntu, but on a machine with Debian "Stretch" installed using a custom Linux 4.2.3 kernel that I enabled
EXT4_FS_ENCRYPTION
on.The instructions given by kmeaw don't work for me exactly as posted. A few things were left out (command line parameters and steps).
e2fsprogs
as shown aboveGenerate your random salt. I used the following to store it in a "safe place":
In order to use ext4 encryption on the file system, the "encrypt" flag must be set in the super-block. This is not the default when the ext4 file system is created. Using the "tune2fs" utility from e2fsprogs 1.43 or later, set the "encrypt" option:
Mount or remount the file system so the kernel knows about the change (maybe it's automatic, but I have only done this on a separate partition, so I'm not sure.)
Create a directory on the file system that is mounted with encryption enabled:
Create the key in the keyring and use it to set the policy for the directory to be encrypted (the
sudo
command is not needed here):After each reboot, the
add_key
command can be used set the key for decryption of the directory and its descendants:Enter the same password used in the previous step, and you don't have to remember the descriptor hex string.
You can also use
add_key
directly. This will use a filesystem specific salt (So all folders under that partition will have the same salt)