sam_ames
(Sam)
27
The only thing I have done is installed the os, made a volume group and fresh volume with luks, mounted it at /data and added my project source code to within /data.
Here are the commands I used:
Create encrypted software Raid1 volume
To use all free space to create a soft raid 1 mirrored across 2 disks:
Check volumes, space used and available with:
sudo fdisk -l
Create a new partition on /dev/sdb:
sudo fdisk /dev/sdb
Use the options "n" (new partition), "p" (primary partition), and accept default partition number, starting sector, and ending sector to use the remaining space.
Use "w" to save the changes and exit.
Create a new partition on /dev/sdc:
sudo fdisk /dev/sdc
Use the options "n" (new partition), "p" (primary partition), and accept default partition number, starting sector, and ending sector to use the remaining space.
Use "w" to save the changes and exit.
Set up RAID 1:
Run the command following command, but (if different) replace with the new partition you created previously with the other new, matching size partition:
sudo mdadm --create /dev/md4 --level=mirror --raid-devices=2 /dev/sdb5 /dev/sdc5
Verify the RAID 1 array is synchronized:
watch cat /proc/mdstat
Encrypt the RAID array:
sudo cryptsetup luksFormat /dev/md4
Type "YES" and enter a passphrase when prompted.
Open the encrypted RAID array:
sudo cryptsetup luksOpen /dev/md4 raid_encrypted
Create a physical volume (PV) on the encrypted RAID array:
sudo pvcreate /dev/mapper/raid_encrypted
create vg
sudo vgcreate ubuntu-vg /dev/mapper/raid_encrypted
create vg 100% available space:
sudo lvcreate -n encrypted_volume -l 100%FREE ubuntu-vg
Format the encrypted volume with a ext4:
sudo mkfs.ext4 /dev/ubuntu-vg/encrypted_volume
sudo mount /dev/ubuntu-vg/encrypted_volume /data
sudo mdadm --readwrite /dev/md127
watch cat /proc/mdstat
If you think it will make a difference, I can start over by reinstalling and using fresh Ubuntu 22.04.
I wiped the /data volume previously and it broke the ubuntu ssh… It seems like /data/lost+found is quite important.
Regards,
Sam