I needed a small cheap NAS for keeping a remote backups. As speed was not an issue, I opted to use a Raspberry Pi with an external USB disk.

To keep it secure if the disk would be stolen or lost, I wanted encryption on it.

OpenMediaVault looked like a good candidate so I downloaded the image and flashed it to a sd-card installed the LUKS plugin and though I was done...

Everything looked good, but fell short due to the lack of "dm_mod" support. Rather than trying to get it working with kernel re-compile and what not, I went the Rasbian route. (Raspberry Pi doesn't seem to be supported on Armbian either)

So to remember my endeavors, I'll document it here for future reference.

Hardware used:
* Raspberry Pi 3B+ (and the bits needed to run it, like case, sd-card, psu etc.)
(I used a 16GB sd-card, that should be more than enough)

* USB disk(s)
(As a disk I used one of the left over LaCie chassis that I had shucked for my big NAS upgrade. Populated with a 2TB WD Green drive)

Software used:
Raspbian latest available (at the time of writing: Stretch light).
OpenMediaVault

Installation steps:
Flash the sd-card with Raspbian.

Boot the Raspberry Pi and do the updates etc.

sudo apt update && sudo apt upgrade -y

Change password on pi user and enable root login (optional...).

Install cryptsetup etc:

apt install aptitude cryptsetup
update-initramfs -u

Create a sources list file for OMV:

nano /etc/apt/sources.list.d/openmediavault.list

Contents:

deb http://packages.openmediavault.org/public arrakis main
# deb http://downloads.sourceforge.net/project/openmediavault/packages arrakis main
## Uncomment the following line to add software from the proposed repository.
# deb http://packages.openmediavault.org/public arrakis-proposed main
# deb http://downloads.sourceforge.net/project/openmediavault/packages arrakis-proposed main
## This software is not part of OpenMediaVault, but is offered by third-party
## developers as a service to OpenMediaVault users.
# deb http://packages.openmediavault.org/public arrakis partner
# deb http://downloads.sourceforge.net/project/openmediavault/packages arrakis partner

Add the key:

wget -O - http://packages.openmediavault.org/public/archive.key | apt-key add -

Update the package cache

apt-get update

Install packages needed for installation of omv-extras etc.

apt install -y resolvconf dirmngr

Install OpenMediaVault

apt install -y openmediavault openmediavault-keyring

Initialize system

omv-initsystem

Install omv-extras (LUKS plugin etc)

wget http://omv-extras.org/openmediavault-omvextrasorg_latest_all4.deb
dpkg -i openmediavault-omvextrasorg_latest_all4.deb

Update the package cache

apt-get update

Go into the UI and configure the basics for OMV.

Default username and password is: admin / openmediavault


Update the packages.
Install LUKS under plugins.

There will be a new option under storage called "Encryption"

Press create and select the device (for example /dev/sda) and type in a passphrase.
(The disk encryption in OMV with this plug-in is designed to be on a per device basis)

I had some issues with my disk since it had been used before.First I had to use gdisk in a shell to wipe it and create a new GPT table.Then I had to go into disks in OMV and wipe it.First after these steps it was visible under devices in create under encryption.

When it's created you need to unlock it to use it using the unlock button. (It will be neede to be unlocked on every boot).

The encrypted disk is now available to create a partition and then file system on under the device mapper ("-crypt" is added to the name, so disk "sda" becomes "sda-crypt").

Create partition

gdisk /dev/sda

Create a filesystem (I picked XFS)

mkfs.xfs /dev/mapper/sda-crypt

Now the newly created filesystem will be visible in the UI as /dev/dm-0

Inspiration for this was found here.