@paddylandau yes you can encrypt a whole disk. As you know luksFormat creates a LUKS volume (an encrypted container) and this can be done on whatever device /dev/sd? or whatever existing partition you may want the LUKS volume to live on, such as /dev/sdc3 for example
Next, when you luksOpen the encrypted volume, you can do whatever you want inside it such as create other partitions (i.e. an LVM scheme can be placed inside the volume).
For example, something like this - we’ll assume we are setting this up on an external, portable 1TB USB SSD
# become root briefly so you don't need to type sudo so much
sudo -i
lsblk (find your empty disk /dev/sd? - then check to be sure w/fdisk)
fdisk -l (identify the correct disk - do you have the right one? - last chance)
cryptsetup luksFormat /dev/sdd (for example)
cryptsetup luksOpen /dev/sdd NAMEYOUPICK (sdd1_crypt for example. you can call it bambi, whatever)
# this opens the drive & maps sdd1_crypt to sdd
# Next create your LVM PV (physical volume) inside the LUKS container. See Man-pages for pvcreate, vgcreate, & lvcreate usage:
# We'll create one PV on sdd1_crypt:
pvcreate /dev/mapper/sdd1_crypt
# Now we need a LVM VG (volume group), we'll call it WD-vg. This is created in the /dev/mapper/sdd1_crypt PV we created in the previous step:
vgcreate WD-vg /dev/mapper/sdd1_crypt
# Now for our LVM LVs (logical volumes). These are logical partitions on the VG as follows:
lvcreate -n cloudy-bak -L 10g WD-vg
lvcreate -n storage-bak -L 200g WD-vg
lvcreate -n projects-bak -L 50g WD-vg
lvcreate -n myhomes-bak -L 300g WD-vg
# Good to verify the output of the following commands now
pvs
vgs
lvs
# We now need a file system on our LVs, we chose ext4:
mkfs.ext4 /dev/WD-vg/cloudy-bak
mkfs.ext4 /dev/WD-vg/storage-bak
mkfs.ext4 /dev/WD-vg/projects-bak
mkfs.ext4 /dev/WD-vg/myhomes-bak
# Create whatever mountpoints you want first, then mount the LVs. Each LV needs it's own mountpoint.
mount /dev/WD-vg/cloudy-bak /media/cloudy
mount /dev/WD-vg/storage-bak /media/storage
mount /dev/WD-vg/projects-bak /media/projects
mount /dev/WD-vg/myhomes-bak /media/myhomes
So all this LVM structure is inside our LUKS encrypted volume. When we luksClose the volume, we’ll need our passphrase or whatever other key we may have created so we can open the encrypted volume again in the future.
You can do the same thing inside a regular disk partition and have a LUKS volume on some partition, and it can even be alongside other non-LUKS partitions on the same disk.
The above example, LUKS encrypting a whole disk /dev/sd? is not best when the disk is being used to install an Ubuntu OS. I think /boot for example is supposed to be outside a LUKS container, and outside an LVM structure as well if you are using LVM. For Ubuntu OS installs, your Ubuntu installer will handle this for you when you select full disk encryption, or LVM + encryption on your laptop desktop install for example. So I personally only consider “whole disk” encryption, as illustrated above, just for files and other data stuff in transit or which can easily be lost, misplaced, or stolen.
This was a quick “throw together” so test it in a VM or some other old blank disk you want to play around with. You can skip all the LVM steps if you just want to create one big file system inside your LUKS volume. It would be something like (sudo mkfs.ext4 /dev/mapper/sdd1_crypt)
@matt65
https://manpages.ubuntu.com/manpages//lunar/man8/cryptsetup-luksHeaderBackup.8.html
https://manpages.ubuntu.com/manpages/questing/man8/cryptsetup-luksHeaderRestore.8.html