I'm trying to clone my SDD to a larger device so I will have a bootable backup in anticipation of doing a system upgrade on several desktop clients. I also want to model a known-correct procedure to see if I can reliably clone my system drives to a larger HDD/SDD (so far all attempts to do this in the past have failed). Currently running 16.04 LTS which was built using the fully encrypted disk option. The test system being used is running fine.

I followed several procedures I found on this site but none worked. I hit a dead end with each procedure. So to simplify things, I did the following:

sudo dd if=/dev/sda of=/dev/sdd  bs=64k

Opened GParted and deleted the old crypt-luks partition on /dev/sdd as instructed in the procedure posted at Cloning Encrypted SSD to larger SSD. This was a mistake and I was dead in the water from here on. I was unable to create a new crypt-luks partition.

So an answer that explains how to [re]create/resize the crypt-luks partition on the new target drive would be very helpful.

I repeated the dd and tried expanding the target filesystem with the following commands (using LiveCD):

sudo cryptsetup luksOpen /dev/sda5 sda5_crypt
sudo cryptsetup resize sda5_crypt
sudo modprobe dm-crypt
sudo vgscan --mknodes
sudo vgchange -ay
sudo pvresize /dev/mapper/sda5_crypt
sudo lvresize -l +100%FREE /dev/ubuntu-vg/root

returns: New size (7020 extents) matches existing size (7020 extents).

sudo pvchange -x n /dev/mapper/sda5_crypt


Physical volume "/dev/mapper/sda5_crypt" is already unallocatable. Physical volume /dev/mapper/sda5_crypt not changed 0 physical volumes changed / 1 physical volume not changed

sudo e2fsck -f /dev/mapper/ubuntu--vg-root


Pass 5: Checking group summary information /dev/mapper/ubuntu--vg-root: 296641/1798720 files (0.8% non-contiguous), 3525828/7188480 blocks

The source SDD was 32Gb and the HDD I am trying to expand is 80 Gb

sudo resize2fs -f /dev/mapper/ubuntu--vg-root


resize2fs 1.44.1 (24-Mar-2018) The filesystem is already 7188480 (4k) blocks long. Nothing to do!

So it appears that the procedure did not expand the partitions. This is verified by rebooting and running GParted which shows the same partitioning before and after:

enter image description here

enter image description here

enter image description here

enter image description here

I've been at this for many days doing research and trying to get this to work and I'm starting to get tunnel vision. I would VERY much appreciate someone posting a bullet-proof procedure that is known to work in cloning encrypted HDDs/SDDs to larger storage devices.

This is NOT a duplicate question. The several answers I found on here did not work for me. And all of those answers contained multiple comments posted by others who tried those procedures and failed.

The target dd drive will indeed boot without expanding any partitions.

My primary question is really much more about expanding encrypted file systems than it is about cloning them. Although these two tasks are obviously very closely related. A bullet-proof, scaleable, reliably repeatable procedure that explains how to do both would be extremely helpful. The procedure https://help.ubuntu.com/community/ResizeEncryptedPartitions is a bit too complex for me to follow although I believe I ran the procedure correctly. It's probably very close to what I need but may be missing a step or two.

It seems to me that simply expanding the encrypted partitions on a properly cloned device ought not require more than several commands. Ideally, this is something easily done using GParted.

Many thanks in advance.

  • I believe cryptsetup puts its mapped devices under /dev/mapper/ not /dev/, so you might try with /dev/mapper/sdd5_crypt. – Sebastian Jan 18 at 21:28

I'll need to test this on a completely clean set of circumstances but running these commands at the end of the above described procedure seems to work. I will update this solution if I hit any more snags.

sudo parted
(parted) print                                                         
(parted) resizepart
Partition number? 2
End?  [32.0GB]? 100%
(parted) print                                                
(parted) quit 

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.