Last active
November 15, 2018 15:18
-
-
Save Jetchisel/7908004 to your computer and use it in GitHub Desktop.
Some sort of progress output for dd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Run dd in the background and save it's PID in the pid variable. Increase the bs if needed. | |
| ## Replace the "source" and "destination" of course! | |
| dd if=source of=destination bs=4M & pid=$! | |
| ## It should give you your shell back. When it does, run the code below. | |
| while ((pid)); do kill -USR1 "$pid" 2>/dev/null || break; sleep 5; done | |
| ## OR | |
| until ((! pid)); do kill -USR1 "$pid" 2>/dev/null || break; sleep 5; done | |
| ## The while/until loop check's if "$pid" is not empty, then run kill every 5 seconds. | |
| ## Run 'dd --help | tail -n 19' for some info about the kill part. | |
| ## Question: Why do i have to do that when i can install dd_rescue or pv so i can have some fancy output? | |
| ## Answer: If you're doing some rescue/saving your system using some limited tools, then good luck guessing when will it finish! | |
| ## Other than that... just sit back, watch and enjoy! | |
| Upate: | |
| The latest dd from openSUSE Leap 15.0 has some new option [ dd (coreutils) 8.29 ] | |
| status=progress | |
| oflag=sync | |
| Add those options when running dd and voila! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment