Encrypting Storage Devices

30 minutes
  • 4 Learning Objectives

About this Hands-on Lab

In this hands-on lab, we will learn how to encrypt a storage medium, such as a USB stick or SD card. When a storage device is encrypted, no one can access the data on it without the correct key. That way, even if you lose the device, the data on the device will remain secret.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Install the `cryptsetup` Utility
  1. Run the following command:
    sudo yum install cryptsetup-luks
Encrypt and Format the Storage Device
  1. List all of the available storage devices.
    sudo fdisk -l
  2. Locate the device that is approximately 3 GB in size and has no partitions.
  3. Encrypt and format the device.
    sudo cryptsetup -y -v luksFormat <DEVICE_NAME>
Configure the Storage Device
  1. Open the device.
    sudo cryptsetup luksOpen <DEVICE_NAME> LA
  2. Check the status of the device.
    sudo cryptsetup -v status LA
  3. Find the header information for the device.
    sudo cryptsetup luksDump <DEVICE_NAME>
  4. Clear the device.
    sudo dd if=/dev/zero of=/dev/mapper/LA bs=128
  5. Create a filesystem on the device.
    sudo mkfs.ext4 /dev/mapper/LA
  6. Create a new directory to serve as the mount point.
    mkdir LA
  7. Mount the filesystem.
    sudo mount /dev/mapper/LA LA/
Unmount and Lock the Device
  1. Unmount the device.
    sudo umount LA/
  2. Lock the device.
    sudo cryptsetup luksClose LA

Additional Resources

  • First, install the cryptsetup tool using yum.

  • Next, find a device to encrypt. You can do this by running sudo fdisk -l, which will give you a list of all the available storage devices.

  • Select the device that has no partitions and is approximately 3 GB in size.

  • Encrypt the device, then open it.

  • Format the device to create a filesystem on it.

  • Finally, mount the device, then unmount it and exit.

What are Hands-on Labs

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.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?