How to clone a LUKS-encrypted HDD to a larger SSD
Migrating LUKS-encrypted drive to a larger one is actually quite simple if you have gparted
:
- If the drive is not unlocked, unlock it as usual.
- If the unlocked drive is mounted, unmount it:
sudo umount /path/to/unencrypted-volume
- Figure out the device name:
lsblk
, look for typecrypt
, e.g./dev/sdb
, and check which device name is the last one. - Plug in the new drive and run
lsblk
again, a new device, e.g./dev/sdc
or simplysdc
has been added. - Clone drive
sdb
tosdc
(CAREFUL, ALL DATA WILL BE OVERWRITTEN ON THE TARGET DRIVE!):time sudo dd if=/dev/sdb of=/dev/sdc bs=64K conv=sync,noerror status=progress
- Afterwards you will have to resize the larger target drive:
sudo gparted
will open the partition editor. - Select the target drive that you want to extend. The LUKS partition on that drive will likely have a warning icon right next to the partion name. Using the menu select
Partition > Check
and click the check mark icon to run the check and repair routines. - After those routines have finished, the partition should be extended.
About the author
Jan Beilicke is a long-time IT professional and full-time nerd. Open source enthusiast, advocating security and privacy. Sees the cloud as other people's computers. Find him on Mastodon.