Skip to content

Instantly share code, notes, and snippets.

@ayr-ton
Created June 30, 2026 00:51
Show Gist options
  • Select an option

  • Save ayr-ton/6c71846741c4f5244bb457397f8eb1cf to your computer and use it in GitHub Desktop.

Select an option

Save ayr-ton/6c71846741c4f5244bb457397f8eb1cf to your computer and use it in GitHub Desktop.
Clone LUKS-encrypted NX-1TB 2280 with ddrescue from live USB

Clone LUKS-encrypted NX-1TB 2280 to USB-C SSD with ddrescue

Use this guide from a Linux live USB with the computer powered off. This clones the entire disk byte-for-byte, keeping LUKS encryption intact.

1. Boot from the live USB

  1. Power off the computer.
  2. Insert the live USB.
  3. Power on and open the boot menu (F2, F10, F12, or Esc).
  4. Select the USB device and choose Try without installing.

Do not mount the internal disk or the destination SSD.

2. Identify source and destination disks

Open a terminal and run:

lsblk -d -o NAME,SIZE,MODEL,TRAN,SERIAL

Expected source: /dev/nvme0n1 (NX-1TB 2280). Destination will usually appear as /dev/sda, /dev/sdb, /dev/sdc, etc.

Warning: verify the destination by size and model. Writing to the wrong disk destroys data.

3. Confirm destination is large enough

lsblk -d -o NAME,SIZE,PHY-SEC,LOG-SEC /dev/nvme0n1 /dev/sdX

Replace /dev/sdX with the real destination path. The destination must be at least as large as the source.

4. Wipe destination partition signatures (optional, recommended)

sudo wipefs -af /dev/sdX

5. Clone the entire disk with ddrescue

sudo ddrescue -f -n /dev/nvme0n1 /dev/sdX clone.log
sudo ddrescue -d -f -r3 /dev/nvme0n1 /dev/sdX clone.log

What this does:

  • /dev/nvme0n1 — source disk.
  • /dev/sdX — destination disk.
  • clone.log — progress/resume log written to the current directory.
  • -f — force overwrite of destination.
  • -n — first fast pass, skipping bad sectors.
  • -d -r3 — direct I/O and retry bad sectors up to 3 times.

This copies the partition table, EFI partition, LUKS header, encrypted data, and trailing space.

If ddrescue is not available, use dd:

sudo dd if=/dev/nvme0n1 of=/dev/sdX bs=1M status=progress conv=sync,noerror

6. Flush caches and verify

sync

Compare partition tables:

sudo sfdisk -d /dev/nvme0n1
sudo sfdisk -d /dev/sdX

Compare LUKS headers:

sudo cryptsetup luksDump /dev/nvme0n1p2
sudo cryptsetup luksDump /dev/sdX2

7. Optional: byte-level spot check

sudo cmp -n 1G /dev/nvme0n1 /dev/sdX

A full-disk comparison takes as long as the clone, so it is usually skipped if ddrescue finished without errors.

8. Safely disconnect

sudo udisksctl power-off -b /dev/sdX

Then shut down the live environment.

9. Test booting from the copy SSD

  1. Power off.
  2. Remove the live USB.
  3. Keep the USB-C copy SSD connected.
  4. Power on and open the boot menu.
  5. Select the USB-C SSD as the boot device.
  6. At the LUKS prompt, enter the same passphrase used for the original.

Important caveats

  • UUID collision: the copy has the same partition UUIDs and LUKS UUID as the original. Do not boot with both disks connected at the same time, or the system may mount the wrong one.
  • UEFI boot entry: some firmware may not auto-detect the USB-C SSD. Manually select it in the boot menu, or add a UEFI entry with efibootmgr.
  • Disk size differences: if the destination is larger than 1 TB, the extra space remains unallocated. Expanding the LUKS container and Btrfs requires decrypting, which you want to avoid.
  • Bad sectors: if the source disk has hardware errors, ddrescue will report them. The clone may be incomplete.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment