If you want a progress report and your unix variant doesn't provide an easy way to get at a file descriptor positions, you can install and use pv instead of cat.ĭd uses a very small blocksize by default (512 bytes). If you want a progress report, since you're using Linux, you can easily get one by noting the PID of the cat process (say 1234) and looking at the position of its input (or output) file descriptor. If you want to run this command in sudo, you need to make the redirection happen as root: sudo sh -c 'cat /dev/sdb >/dev/sdc' (In some benchmarks I made a couple of years ago under Linux, cat was faster than cp for a copy between different disks, and cp was faster than dd with any block size dd with a large block size was slightly faster when copying onto the same disk.) cat /dev/sdb >/dev/sdc It then goes through two pipes before being written. The data is read 128kB at a time (which is better than the dd default of 512B, but not as good as even larger values). Your new command sudo dd if=/dev/sdb bs=128K | pv -s 3000G | sudo dd of=/dev/sdc bs=128K is again needlessly slow and complicated. There is no magic in dd, the magic is all in /dev/sdb. While dd still useful for some relatively rare tasks, it is a lot less useful than the number of tutorials mentioning it would let you believe. Nowadays, dd if=/dev/sdb of=/dev/sdc is a just complicated, error-prone, slow way of writing cat /dev/sdb >/dev/sdc. Dd was useful in the old days when people used tapes (when block sizes mattered) and when simpler tools such as cat might not be binary-safe.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |