Skip to main content
This guide is written for Ubuntu 24.04. Other operating systems and distributions may require different tools or steps — adapt accordingly.
Disk encryption ensures that data stored on your server is unreadable without the correct passphrase, protecting it against physical theft or unauthorized hardware access. Choose the approach that matches your situation:
  • Clean machine — no OS installed yet. Full-disk encryption is set up during Ubuntu installation.
  • Zylon already installed — encrypt a separate data partition without reinstalling.

Option 1: Clean Machine — Full-Disk Encryption During Installation

This is the recommended approach. Ubuntu’s installer can encrypt the entire disk using LUKS (Linux Unified Key Setup) with a single passphrase.
1

Boot from Ubuntu 24.04 installer

Download the Ubuntu 24.04 Server ISO and boot your machine from it.
2

Proceed through installer until storage configuration

At the Storage configuration screen, select Custom storage layout and then choose Use entire disk option.
3

Enable encryption

Check Encrypt the LVM group with LUKS. You will be prompted to set a passphrase.Choose a strong passphrase and store it securely — losing it means losing access to all data.
4

Complete installation

Finish the installer normally. On every boot, you will be prompted to enter the passphrase before the system starts.
5

Install Zylon

Once Ubuntu is running, follow the standard Zylon installation guide.

Option 2: Zylon Already Installed — Encrypt a Data Partition

If Zylon is already running, a full reinstall is disruptive. Instead, you can create an encrypted partition for Zylon’s data directory (/var/zylon) using LUKS and move the data into it.
This is a complex, high-risk operation. Data loss is possible if anything goes wrong.Before proceeding, back up all Zylon data and move it off the server:
Copy the resulting backup file to a safe external location (S3, another machine, etc.) and verify you can access it before continuing. Do not proceed without a verified backup.See the Backup guide for details.

Prerequisites

  • A spare disk or unpartitioned space available on the server.
  • cryptsetup and rsync installed:
1

Identify the target disk or partition

List available block devices to find your spare disk (e.g. /dev/sdb). The -e 7 flag excludes loop devices (snap packages) to reduce noise:
2

Create and format the LUKS container

Replace /dev/sdb with your actual device. This will erase all data on it.
You will be prompted to confirm (YES) and set a passphrase.
3

Open the encrypted container

This maps the container to /dev/mapper/zylon-data.
4

Create a filesystem on the mapped device

5

Stop Zylon before migrating data

6

Mount the encrypted partition and migrate data

Verify the copy completed successfully before continuing.
7

Replace the original data directory with the encrypted mount

8

Configure automatic mounting at boot

Add the LUKS device to /etc/crypttab:
Append a line to /etc/crypttab (replace YOUR_UUID with the value above):
Then add the mount to /etc/fstab:
Using none as the key file means the passphrase will be prompted at every boot. For headless servers, see the Ubuntu documentation on remote LUKS unlocking.
9

Start Zylon and verify

Confirm everything is working, then remove the backup:

Automated script (alternative)

The script below performs all the steps above interactively. It will ask for the target disk and the LUKS passphrase, then handle the rest.
Review the script before running it. It will erase the target disk and stop Zylon during the migration.
Save it as encrypt-zylon.sh and run with sudo bash encrypt-zylon.sh.
The passphrase will be prompted at every boot. For headless servers, see the Ubuntu documentation on remote LUKS unlocking.