Note: I am using ubuntu server.
I have an nvme main drive, and I have two of the same 2tB hard drives.
I connected one of my hard drives and ran dd if=/dev/nvme0n1 of=/dev/sda2 status=progress
It copied about 40gB of data, then I restarted and booted from the hard drive and I had a working clone.
Then I removed that hard drive and connected the other hard drive, then ran sudo dd if=/dev/nvme0n1 of=/dev/sda2 status=progress
I added sudo the second time, because I wasn't sure if I had used it the first time (I probably did not).
It is currently at 805gB copied and still going. Why the massive discrepancy?
Update: I started over and ran dd if=/dev/nvme0n1 of=/dev/sda status=progress
but it said permission denied. So I added sudo, and now it's cloning everything again -- currently at 129gB. I am still confused as to why I was able to clone with only 40gB of transfer the first time.
dd
is byte-for-byte copying, including 'empty space'. It's not designed to exclude free space, it will iterate until the entire disk is copied byte-for-byte. This is just howdd
was designed. There are other mechanisms such as partclone or others (utilized by things like Clonezilla) which will be free-space-aware and makes cloning data and not free space easier, but that's not howdd
was designed. – Thomas Ward Sep 26 '23 at 16:01dd
. See also this link./dev/sda2
is partition #2 on the drive/dev/sda
; 2. I use Clonezilla with nvme drives, SATA drives and USB drives without problems. Which version of Clonezilla did you try? – sudodus Sep 26 '23 at 16:18/dev/sda2
was limiting the size of the transfer; 2. And cloning withdd
needssudo
; 3. Anyway, I suggest that you try again with Clonezilla. It should work, and is much more efficient because it will only copy used data blocks (and skip those that are not used). Furthermore it is safer because there are 'checkpoints' that let you double-check that your target is the correct one. – sudodus Sep 26 '23 at 19:44