Cloning an SSD in Linux

Migrating to a larger SSD while copying the old one.

Disclaimer: This is a post published for the sake of getting it out there. It may not be complete.

(We make some assumptions here – for this article, I’m using a desktop computer to do the hard work of cloning an SSD coming out of a laptop. I’m also using an M.2 SSD enclosure that connects via USB-C 3.1)

  • First, connect the SSD to desktop, and image it. When doing this, BS (Block Size) makes a huge difference on actual imaging speed. Also, the physical connections and interface it’s hooked up to heavily impacts performance.
  • Determine which disk you’re trying to image (to and from) lsblk
  • IF is the “input file (source)” and OF is the “output file (destination)” – the OF can be a physical local file.
  • time sudo dd if=/dev/nvme1n1 of=/dev/sda bs=10M conv=sync,noerror status=progress | gzip -c > /path/to/my-disk.image.gz
  • gunzip -c IMAGE.HERE-GZ | dd of=/dev/OUTPUT/DEVICE-HERE
  • time gunzip -c NAME.image.gz | sudo dd of=/dev/sda bs=10M status=progress

To store local – time sudo dd if=/dev/nvme1n1 bs=10M conv=sync,noerror status=progress | gzip -c > /path/to/my-disk.image.gz

To go direct to another disk on system – time sudo dd if=/dev/nvme1n1 of=/dev/sda bs=10M conv=sync,noerror status=progress

Leave a Reply

Your email address will not be published. Required fields are marked *