Hello. There is a Centos 7 server on which there are 2 disks. There is data on the second disk and you need to encrypt it with Luks but don't lose the data (don't do cryptosetup -y luksFormat). Please tell me how to do it right.
Thanks a lot!
ps An example of encrypting a partition without data loss:
- Unmount our disk
- Check fs for errors:
e2fsck -f /dev/sda1
- Now you need to reduce the size of the file system:
resize2fs /dev/sda1 $size-10M(10Mb should be enough for the LUKS header)
- Then the encryption process itself is
luksConvert /dev/sda1(here the options may differ depending on whose script you decide to use, they will have to be downloaded and installed not from official reps)