Rekeying a Disk using the CLI

When KeyControl rekeys a disk, it creates a new key and then begins decrypting the disk using the old key. As each block is decrypted, the Policy Agent re-encrypts it using the new key.

The following procedure applies to all types of Windows disks and to Linux data disks. You cannot, however, rekey a Linux system device (such as /root, swap, or /home) using this procedure. Instead, use the htroot rekey command as described in Rekeying a Linux System Device.

Tip: Depending on the size of the encrypted disk, the rekey process can take a long time to run. If the rekey 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 reissue the hcl rekey command to resume the process. We recommend you use the Linux nohup or screen command to avoid terminal-related interruptions during the rekey.

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 check the available disks on this VM, enter the hcl status command.
  3. If this VM belongs to a Cloud VM Set that uses the Single Encryption Key (SEK) option and you want to verify that there is a new version of the SEK key available, enter the hcl keyversion diskname command, where diskname is the name of the disk that you want to rekey. For Linux, use the short form of the disk name. (For example, sdb1 instead of /dev/sdb1.) For Windows, specify the drive letter or folder mount associated with the disk. (For example, f: or g:\data).

    The command returns the key version being used by the disk as well as the current SEK key version. The following example shows a disk that is currently encrypted with an older version of the SEK key:

    # hcl keyversion sdb1
    keyversion: 2 SEKversion: 4

    In this case, you should rekey the disk to bring it up to date. If the key version matches the SEK version however, there is no need to rekey the disk. For more information on the SEK option, see Data Deduplication with Cloud VM Sets.

  4. If this is a Linux system and you have not enabled Online Encryption for this VM, unmount the disk you want to rekey. For more information, see Linux Online Encryption Prerequisites and Considerations.
  5. Enter the command hcl rekey [-s] diskname, where:

    • -s (Linux only) tells DataControl to only process allocated blocks which can improve performance dramatically. DataControl uses system-provided utilities to determine the allocated blocks on the disk. This option is supported for ext2, ext3, and ext4 file systems. It is not supported on XFS. (To change the speed for Windows, see Changing the Encryption/Decryption Speed on Windows.)

      Important: This option does not work if online encryption has been enabled for the VM, even if you unmount the drive during the process. If online encryption has been enabled or if the disk is mounted, using the -s option will cause the command to fail.

    • diskname is the name of the disk that you want to encrypt. For Linux, use the short form of the disk name. (For example, sdb1 instead of /dev/sdb1.) For Windows, specify the drive letter or folder mount associated with the disk. (For example, f: or g:\data).
  6. For Linux, the progress of the command is displayed automatically. For Windows, use the hcl status command to check the progress.

  7. If the rekey operation is interrupted on Windows, the Policy Agent automatically restarts it when the system comes back online. For Linux, you can:

    • Resume the rekey operation by reissuing the hcl rekey command.
    • Revert the rekey operation using the hcl rekey -u diskname command.