Migrating a Block Storage volume to an encrypted LUKS volume
Objective
OVHcloud now offers Block Storage volumes encrypted with LUKS. Currently, it is not possible to directly convert an existing volume to a LUKS encrypted one using the retype option, nor to back up and restore it as a LUKS volume.
This guide explains how to migrate your data from a standard Block Storage volume to a new LUKS encrypted volume by creating a new volume and copying your data across safely.
Requirements
- A Public Cloud instance in your OVHcloud account
- An existing Block Storage volume (source)
- Administrator (root or sudo) access to your instance
Instructions
Step 1: Create a LUKS volume
In your OVHcloud Control Panel, create a new Block Storage volume and select the LUKS type.
Once attached to your instance, the LUKS volume behaves like a standard volume. All encryption and unlocking are handled automatically by the OVHcloud infrastructure.
Step 2: Attach the volumes to your instance
-
Attach both volumes to your instance:
- Source volume (non encrypted)
- Target volume (LUKS encrypted)
-
Verify that both volumes are visible on your instance:
Example output:
Step 3: Prepare the LUKS (encrypted) volume
- Format the LUKS volume with the filesystem of your choice (for example, ext4):
- Mount the target volume:
Step 4: Mount the source volume
If not already mounted, mount the source volume to your instance:
Step 5: Copy the data
Use rsync to copy your data from the source volume to the LUKS encrypted target volume while preserving permissions and attributes:
Step 6 (Optional): Verify and detach
-
Verify that your data has been copied successfully. You can use commands like
ls,du, orrsync --dry-runfor quick checks. -
Unmount both volumes:
- Detach the source volume if it is no longer needed.
Step 7 (Optional): Update your mount points
If the LUKS volume should be used permanently, add an entry to /etc/fstab to mount it automatically at boot.
Example:
Notes:
Replace with the actual UUID of your LUKS volume (obtain it with sudo blkid /dev/vdc).
Ensure the mount point /mnt/data exists before boot or the system may fail to mount the volume.
Go further
Join our community of users.