logoalt Hacker News

fhdkweigtoday at 5:16 PM2 repliesview on HN

I've seen "dd if=/dev/removable of=/dev/removable" suggested. I don't know if it actually works or if the OS optimizes it to a no-op.


Replies

valleyertoday at 7:32 PM

Certainly the OS can't optimize it to a no-op, since `dd` makes separate read and write syscalls.

I suppose your `dd` implementation itself could do so, but I don't know why it would.

piyhtoday at 6:33 PM

the risk of catastrophic data loss from misuse of `dd` makes my hackles rise just looking at this.

I will never forget when I mixed up `if` and `of` during a routine backup.

`cat /dev/sda > /mnt/myDisk2` is so much safer, explicit, and in unix norms. It's also faster because you don't have to tune block size parameters.

Plus you can also do `pv /dev/sda > /mnt/myDisk2` to get transfer speed details.

Friends don't let friends use `dd` where `cat` can do the same job.

show 1 reply