How to Encrypt a Hard Drive Partition on Linux with LUKS

Use GNOME Disks to create a LUKS-encrypted Linux partition, then unlock and test it before storing files. The process formats the selected partition, so back up anything on it first. This GNOME Disks workflow is not an in-place conversion or a way to encrypt an active system partition; use your distribution’s installer for full-system encryption.

What LUKS protects

LUKS encrypts data at the storage layer. A locked volume is unreadable without an authorized key; after it is unlocked and mounted, your account and apps can access its files. Encryption at rest therefore does not protect an already-unlocked computer. Ubuntu’s security documentation explains LUKS protection for data at rest.

This guide covers a data partition or secondary drive. To encrypt the disk containing Linux, use the installer’s boot-time encryption setup and follow its recovery-key instructions; do not reformat the active system disk in Disks.

Before you start

  • Keep the passphrase. Store a strong, unique passphrase securely. If every valid unlock method is lost, the data cannot be recovered. Encrypted drives can also fail, so keep a separate backup.
  • Check compatibility. LUKS is intended for Linux storage. Windows or macOS may need extra software to open it; test your intended setup before relying on cross-platform access.

Encrypt a partition with GNOME Disks

  1. Back up the target. Copy its files to another drive, verify the copy, then unmount the target in Files.
    GNOME Files copying a Documents folder to a separate backup drive before the target disk is formatted
    Keep a verified copy on a different drive before formatting.
  2. Open Disks and identify the data drive. Search your applications for “Disks.” If it is missing, install GNOME Disks from your distribution’s software manager or official repository; the package is commonly named gnome-disk-utility. Select the intended device and check its model, capacity, and volume map; GNOME’s partition guide explains this view and warns that disk tools can erase data. See the GNOME Disks project page.
    GNOME Disks with a 2 TB secondary data drive selected and its device details visible
    Confirm the model and capacity; leave the drive running Linux untouched.
  3. Select the space to encrypt. Select unallocated space and click + to create a partition. Set its size and click Next. Use all available space for one encrypted data partition, or leave some for a separate unencrypted area. Formatting an existing partition erases that partition.
    GNOME Disks showing unallocated space and a size slider for a new partition
    Choose the partition size; the example leaves room for another partition.
  4. Choose a Linux filesystem and enable encryption. Name the volume, choose the Linux filesystem option (usually Linux (ext4)), and turn on Password protect volume. Some versions label this as an encrypted Linux or LUKS option. Do not choose Format Disk unless you intend to erase the partition table and every volume.
    GNOME Disks partition creation dialog with a Linux filesystem and Password protect volume enabled
    Enable password protection; wording can vary between Disks versions.
  5. Set and confirm the passphrase. Continue to the password prompt and enter a strong, unique passphrase twice. Depending on your version, these fields may appear in the same dialog or a separate window. Check your keyboard layout and save the passphrase before proceeding.
    GNOME Disks passphrase prompt with masked passphrase and confirmation fields
    Enter the same passphrase twice and store it securely.
  6. Review and create the volume. Click Create or Format only after checking the drive, size, and encryption choice. Wait for completion. The partition should appear in Disks as a locked LUKS volume. If encryption is not shown, stop before copying sensitive files.
    GNOME Disks showing a newly created 380 GB LUKS encrypted partition in the locked state
    A locked LUKS entry has not been opened yet.
  7. Unlock and mount it. Select the LUKS volume and choose its unlock or open control. Enter the passphrase. If the filesystem does not mount automatically, use the mount control for the unlocked filesystem.
    GNOME Disks passphrase dialog asking to unlock an encrypted data partition
    Enter the saved passphrase to make the filesystem available.
  8. Verify access and unmount safely. Open the volume in Files, create a small test file, and confirm you can read it. Unmount or eject the volume before disconnecting. Linux will ask for the passphrase the next time you connect it.
    GNOME Files open after unlocking the encrypted data volume
    The mounted encrypted volume appears in Files like other storage.

Encrypting a whole secondary drive

For a blank secondary drive, create one LUKS partition using all available space. This encrypts the data partition; basic partition-table information remains visible. To encrypt only part of the disk, make a smaller LUKS partition and leave the rest as a separate filesystem. Files in that other area are not protected by the encrypted volume.

Common problems

  • The encryption option is missing: That device or filesystem choice may not support this route in your version. Cancel without formatting and check your distribution’s LUKS instructions.
  • The passphrase is rejected: Check capitalization and keyboard layout. Do not initialize or reformat the volume to troubleshoot; that can destroy access to encrypted data. Read the upstream cryptsetup/LUKS FAQ before attempting recovery.

Leave a Comment

How to Record Speaker Output on Linux with Audacity

How to Record Speaker Output on Linux with Audacity

Capture Linux desktop audio in Audacity by routing its recording stream to your output device’s monitor source. Follow PulseAudio and PipeWire steps, export tips, and fixes for silent tracks.

How to Use Dropbox on Linux: Install and Sync Your Files

How to Use Dropbox on Linux: Install and Sync Your Files

Install Dropbox on Linux from the official package, sign in, sync a local folder, manage selective sync, and check status from the command line.

How to Install Inkscape on Linux: Ubuntu, Fedora, Arch, and More

How to Install Inkscape on Linux: Ubuntu, Fedora, Arch, and More

Install Inkscape from your Linux distribution’s repositories, the Ubuntu stable PPA, Snap, or Flathub, with current commands and notes for choosing a package source.

How to Find and Remove Duplicate Files on Linux With FSlint

How to Find and Remove Duplicate Files on Linux With FSlint

Use FSlint to scan selected Linux folders, review duplicate groups, and safely delete redundant files or learn when hard-link merging is appropriate.

How to Install SABnzbd on Linux and Configure It

How to Install SABnzbd on Linux and Configure It

Install SABnzbd on Ubuntu or Debian, or run it in Docker on another Linux host. Then open the web interface and configure your provider and download folders.

How to Install the Paper GTK Theme on Linux

How to Install the Paper GTK Theme on Linux

Install the Paper GTK theme from supported Linux repositories, enable it for GTK apps in GNOME Tweaks, and see what the legacy theme can and cannot change.

How to Install and Set Up Plex on OpenMediaVault with Compose

How to Install and Set Up Plex on OpenMediaVault with Compose

The old OpenMediaVault Plex plugin is archived. Set up Plex on OMV 8 with OMV-Extras, the Compose plugin, persistent storage, and Plex’s official container.

How to Clean and Speed Up Ubuntu Safely

How to Clean and Speed Up Ubuntu Safely

Clean and speed up Ubuntu with safe APT cleanup, storage checks, and startup controls that help free space and troubleshoot a sluggish desktop.

How to Install the Hiri Email Client on Linux

How to Install the Hiri Email Client on Linux

Install Hiri on Linux with its Snap package or official tarball, add a desktop launcher, and check supported accounts plus a warning about Hiri’s old Snap release.

How to Get System Specifications for a Linux PC

How to Get System Specifications for a Linux PC

Use Fastfetch and built-in Linux commands to check your distro, kernel, CPU, memory, graphics, storage, and connected devices, then save a clear report.