I am trying to create an encrypted partition for sensitive user data, on my Ubuntu server.
Soft raid is set up on the server and I assume this is what is causing the problem.
After the operating system installation, I checked the partition that I wanted to encrypt, and the only thing within it was a lost and found folder. I deleted that and continued, successfully encrypting the partition.
Everything was good until I tried to SSH in two the installation (I had to do the encryption in rescue mode so that the discs were not in use).
I just kept getting a connection refused error.
I decided to reconnect in rescue mode and attempt to reinstall open SSH.
Systemctl preset command kept failing and the service would not start.
No matter how many times I purged and reinstalled open SSH, it would not work correctly.
Before I encrypted is the volume that only contained the lost and found folder, SSH was working correctly. I really don’t understand what is going on.
Please, somebody tell me how to set up my disk with a large encrypted partition, where I can store all of my data.
(My server is unmanaged, so unfortunately, asking ovh to set this up during installation of the operating system is not really an option)
—————- Update —————-
I retried with a different approach. Unfortunately, the same result. Luks on lvm on raid. I chose this, so I could keep the raid array running whilst setting up the encryption. Before encryption was added, the only contents of the raid volume was something called “lost+found”, I decided it was safe to proceed and go ahead with the encryption. Everything seemed perfect until I rebooted the system. host simply refuses connection on 22.
————— Steps taken to produce the problem —————
1. Set up Ubuntu 22.04 server with two volumes, both using software raid
2. Create a Physical Volume with LVM on the RAID: then turn RAID array into a physical volume (PV) that LVM can use:
sudo pvcreate /dev/md3
3. Create a Volume Group (VG) on the PV: Next, create a volume group:
sudo vgcreate myvg /dev/md3
4. Create a Logical Volume (LV) on the VG: can then create a logical volume on the VG:
sudo lvcreate -l 100%FREE -n mylv myvg
5. Encrypt the LV with LUKS: can now encrypt the logical volume:
sudo cryptsetup luksFormat /dev/myvg/mylv
6. Open the LUKS device: After setting up the encrypted LV, open it:
sudo cryptsetup open --type luks /dev/myvg/mylv cryptlv
7. Create a filesystem: Finally, create a filesystem on the mapped LUKS device:
sudo mkfs.ext4 /dev/mapper/cryptlv
8. Reboot server and attempt SSH connection.