How dd command works in Linux with examples - LinuxConfig.org

Dd is a vary powerful and useful utility available on Unix and Unix-like operating systems. As stated in its manual, its purpose is to convert and copy files. On Unix and Unix-like operating systems like Linux, almost everything is treated as a file, even block devices: this makes dd useful, among the other things, to clone disks or wipe data.


This is a companion discussion topic for the original entry at https://linuxconfig.org/how-dd-command-works-in-linux-with-examples

Great tutorial man. It would be great if you put the warnings before the topic that dd can destroy the data on the disk

Thanks for this tutorial… I was trying to copy data from failed disk and noticed that it read would fail randomly and once read fails, all further reads were failing until I rebooted/remounted disk.
I could only get about 10% copied before it gave error. I realized error was so random, i could actually copy parts at a time.
I would note down how much was copied before error and start copying from that point using skip(read side) and seek(write side) options. it helped get the entire data copied with no errors …
I used spreadsheet to do the math
started with remaining=total_size, done=0
i would do
dd if=/dev/sdc of=/dev/sdb bs=512 count=$remaining skip=$done seek=$done
when it fails, i would subtract the number of blocks succeeded in last dd to remaining and also add the number of blocks written to done
and repeat dd command with new numbers