Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
    • Security
Google Cloud Platform icon
Labs

Creating a New Encrypted Volume Using LUKS

In this hands-on lab, we will use Linux Unified Key Setup (LUKS) to encrypt a volume on a Red Hat host. Then we'll go through the process of unmounting and closing the volume and re-opening and re-mounting the volume, which is standard practice for encrypted volumes not mounted at boot. *This course is not approved or sponsored by Red Hat.*

Google Cloud Platform icon
Lab platform
Lab Info
Level
Intermediate
Last updated
Jul 13, 2025
Duration
30m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Create a New Logical Volume
    1. Run the vgs command to view a list of available volume groups.
    2. Next, run lvcreate -L 100M -n patient_lv luks_vg to create a new logical volume.
    3. Run the lvs command to verify that the new logical volume was created.
  2. Challenge

    Encrypt the Volume with LUKS
    1. Run the following command:
    cryptsetup luksFormat /dev/mapper/luks_vg-patient_lv
    
    1. Type YES at the prompt.
    2. Enter the passphrase Pinehead1! at the next two prompts.
    3. Next, run the command blkid | grep patient, and check for TYPE=crypto_LUKS in the output.
    4. Next, format the volume with the following command:
    cryptsetup luksOpen /dev/mapper/luks_vg-patient_lv patient_lv
    
    1. Enter the passphrase Pinehead1! at the prompt.
    2. Next, run the command ls /dev/mapper, and check for patient_lv in the output.
    3. Run the following command to overwrite all of the storage on the new volume:
    shred -v -n1 /dev/mapper/patient_lv
    
    1. Next, format the new volume using ext4 with the following command:
    mkfs.ext4 /dev/mapper/patient_lv
    
    1. Next, mount the volume to /data.
    mount /dev/mapper/patient_lv /data
    
    1. Run the command ls /data, and check for lost+found in the output.
    2. Check the status of the new encrypted volume.
    cryptsetup -v status patient_lv
    
  3. Challenge

    Create a Test File on the New Volume
    1. Run the command touch test.txt /data to create the test file.
About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight