@andymx Lol, I was showing off. It's actually straight from the arch wiki on dd:
https://wiki.archlinux.org/title/Dd
Great little tool and comes built in (dangerous though). Sometimes, I use clonezilla instead to do the same thing but because that is a boot only environment, I can't browse or use the machine for anything else whilst it' doing it's thing.
Code: Select all
sudo dd if=/dev/sda of=/dev/sdb conv=noerror,sync bs=1M status=progress
sudo dd - dd has to be run as root
if=/dev/sda - tells dd the input file to copy from (in this case the whole drive)
of=/dev/sdb - tells dd the output file to copy to (in this case the whole drive)
conv=noerror,sync - tells dd to continue even if errors are encountered and to sync any data left at the end. This way you ensure nothing is left if you unmount
bs=1M - tells dd what size chunks (block size) to copy data in. 1M (1 Mbyte) makes it a little bit faster for me.
status=progress - tells dd to print it's progress to the screen
I noticed Clonezilla was a much faster, maybe because it copies in bs=4096 (4Mb). Everything has it's pros and cons.