Training

When: Every first Sunday of every month -get a ticket- from $15 (Click Here).

Wednesday, September 27, 2017

monitoring - How do you monitor the progress of dd? - Ask Ubuntu

Method 1: By using pv

Install pv and put it between input / output only dd commands.
Note: you cannot use it when you already started dd.
From the package description:
pv - Pipe Viewer - is a terminal-based tool for monitoring the progress of data through a pipeline. It can be inserted into any normal pipeline between two processes to give a visual indication of how quickly data is passing through, how long it has taken, how near to completion it is, and an estimate of how long it will be until completion.
Installation
sudo apt-get install pv
Example
dd if=/dev/urandom | pv | dd of=/dev/null
Output
1,74MB 0:00:09 [ 198kB/s] [      <=>                               ]
You could specify the approximate size with the --size if you want a time estimation.

Example Assuming a 2GB disk being copied from /dev/sdb
Command without pv would be:
sudo dd if=/dev/sdb of=DriveCopy1.dd bs=4096
Command with pv:
sudo dd if=/dev/sdb | pv -s 2G | dd of=DriveCopy1.dd bs=4096
Output:
440MB 0:00:38 [11.6MB/s] [======>                             ] 21% ETA 0:02:19

Other uses
You can of course use pv directly to pipe the output to stdout:
pv /home/user/bigfile.iso | md5sum
Output
50,2MB 0:00:06 [8,66MB/s] [=======>         ] 49% ETA 0:00:06
Note that in this case, pv recognizes the size automatically.

 

Method 2: New status option added to dd (GNU Coreutils 8.24+)

dd in GNU Coreutils 8.24+ (Ubuntu 16.04 and newer) got a new status option to display the progress:

Example

dd if=/dev/urandom of=/dev/null status=progress

Output

462858752 bytes (463 MB, 441 MiB) copied, 38 s, 12,2 MB/s





monitoring - How do you monitor the progress of dd? - Ask Ubuntu

No comments: