Encrypted Partition
Create a partition using fdisk /dev/sdb.
First check to see if “dm_crypt” has been installed, install if it hasn’t.
1 2 |
lsmod |grep dm_crypt modprobe dm_crypt |
If it hasn’t been loaded
1 |
yum install cryptsetup-luks |
1 2 3 |
cryptsetup luksFormat /dev/sdb1 # Enter YES (uppercase) when prompted and enter the passphrase cryptsetup luksOpen /dev/sdb1 encdisk # enter a name for the encdisk mkfs.ext4 /dev/mapper/encdisk |
1 2 |
mkdir /data mount /dev/mapper/encdisk /data/ |
To check:
1 2 |
df -h mount |
The line to be entered into /etc/fstab
1 |
/dev/mapper/encdisk /data ext4 defaults 0 0 |
To check:
1 2 |
umount /data mount -a |
Line to be entered into /etc/crypttab
1 |
encdisk /dev/sdb1 |
When the OS loads it prompts for a password, for it to prompt for a password it needs a keyfile, which can be created as shown here:
1 2 3 |
touch /etc/keyfile chmod 0400 /etc/keyfile cryptsetup luksAddKey /dev/mapper/VG_sda1-LV00 /etc/keyfile |
/etc/crypttab
1 |
cryptsetup luksAddKey /dev/mapper/VG_sda1-LV00 /etc/keyfile |
Block Recovery
12 March 2019