Monday, May 6, 2024
Homepage · dd
 Popular · Latest · Hot · Upcoming
67
rated 0 times [  67] [ 0]  / answers: 1 / hits: 84687  / 2 Years ago, thu, february 3, 2022, 6:28:43

I set up dd to clone a smaller system 40.00GB hard drive (/dev/sda) to a new bigger 111.00GB one connected via a USB reader (dev/sdb) and Its been going for two hours now. The activity meter on the new hard drive shows it's doing something. But the CPU is only about 20%. When is this thing going to complete? Should I re-start the process?


More From » dd

 Answers
3

In the future, you should use pv to get a running progress bar.



sudo apt-get install pv



With pv installed, let's assume you want to clone a 20GB drive, /dev/foo, to another drive (20GB or larger!), /dev/baz:



sudo dd if=/dev/foo bs=4M | pv -s 20G | sudo dd of=/dev/baz bs=4M



Important bits to notice: the bs=4M argument sets the blocksize for dd operations to 4MB, which drastically improves the speed of the whole thing. And the -s 20G argument tells pv how big this operation is expected to be, so it can give you an ETA as well as a current speed.



I love pv so hard it should probably be illegal.



Note that while doing it this way is intuitive and nice and neat from left to right ordering, piping to and from STDOUT can incur a performance penalty if you're talking about really fast data streams. The following syntax is faster, if you're looking at moving several hundred MB/sec:



pv -s 20G < /dev/foo > /dev/baz



The -s 20G is optional, if you actually know how big (or about how big) the stream will be, it allows pv to give you a time estimate for completion. Without that, pv will try to figure out how large the dataset is if possible (for instance, it knows how big a file is) but if it can't (eg with a block device, not a file), it just tells you the rate of transfer without guessing how long things will take.


[#34110] Saturday, February 5, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tocklftime

Total Points: 110
Total Questions: 109
Total Answers: 100

Location: Mayotte
Member since Mon, Sep 12, 2022
2 Years ago
;