Encrypting a Disk Using the CLI

The following procedure describes how to use the CLI to encrypt a Linux data partition or a Windows boot drive, folder mount, or data drive. During this procedure you can elect to reformat the drive and remove any existing data or keep and encrypt the existing data.

You cannot encrypt a Linux system device (such as /root, swap, or /home) using this procedure. Instead, follow the procedure described in Encrypting Linux System Devices.

Before You Begin 

For Linux disks:

For Windows disks:

  • If this is a Windows data drive, make sure the disk you want to encrypt meets the prerequisites described in Windows Encryption Prerequisites.
  • If this is a Windows boot partition, make sure the partition has been set up as described in Windows Boot Drive Encryption. Note: The boot partition may not appear as an available disk until after the HyTrust Bootloader is installed.
Tip: Depending on the size of the disk, the encryption process can take a long time to run. If the process is interrupted on Windows, it will be resumed automatically when the disk comes back online. If the process is interrupted on Linux, you need to manually restart the process. We recommend you use the Linux nohup or screen command to avoid terminal-related interruptions during encryption.

Procedure 

  1. For Linux, log into the VM as root. For Windows, log in as a System Administrator and open a Command Prompt or start Windows PowerShell.
  2. If you want to reformat the disk and, optionally, create a new filesystem, enter the command hcl add [-F fstype | "none"] [-n] [-c cipher] [-m mapped_device] [-p parent-disk] [-e days_to_expire] [-z "NO USE"|"SHRED"] [-o] [-y] [-x] diskname

  3. If you want to retain and encrypt the data that currently exists on the disk, enter the command hcl encrypt [-s] [-c cipher] [-e days_to_expire] [-z "NO USE"|"SHRED"] [-o] [-y] [-x] diskname

  4. For Linux, the progress of the command is displayed automatically. For Windows, use the hcl status command to check the progress.

    Notes:

    • If the hcl encrypt command is interrupted for any reason, you can re-issue the same hcl encrypt command. The encryption process will start at the point where it was interrupted.
    • If the encryption fails for a Windows disk with the message that there are too many partitions on the disk, see Detecting and Removing a Windows Snapshot Partition.

What to Do Next 

If you removed the /etc/fstab entry for the device, you can recreate that entry using the clear text path created during encryption. For details, see Automatically Mounting Linux Filesystems.