User avatar
DougieLawson
Posts: 37571
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: dd takes so long...

Tue May 24, 2016 8:00 am

sheriff076 wrote:

Code: Select all

$ sudo dd bs=1m if=/dev/rdisk1 of=~/Desktop/ssbackup04.img
Give it more buffers. I ran a DD on a lightly loaded RPi2B that had more than 760M of RAM free with bs=760M and it flew.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

epoch1970
Posts: 4465
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: dd takes so long...

Tue May 24, 2016 9:27 pm

I'll be pedantic and point out that dd on OS X accepts units in lowercase, not uppercase for block size.
man dd wrote:If the number ends with a "b", "k", "m", "g", or "w", the number is multiplied by 512, 1024 (1K), 1048576 (1M), 1073741824 (1G) or the number of bytes in an integer, respectively.
When I backup a 16G SD, I use "if=/dev/rdiskX of=foo.img bs=64k" and usually it takes 20-30 minutes. The SD reader I use is the one hiding in the back of my macmini, it is connected to the PCIe bus (not USB.) Using rdisk instead of disk is of paramount importance.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

jstnn
Posts: 1
Joined: Sun Aug 13, 2017 5:34 am

Re: dd takes so long...

Sun Aug 13, 2017 5:38 am

I also use pv to see the progress of the copy. I'm on a mac so i had to install pv with homebrew

Code: Select all

brew install pv

This is what I use to copy the image on the SD card

Code: Select all

sudo dd if=ubuntu-mate-16.04-desktop-armhf-raspberry-pi.img bs=32m | pv -s 20G | sudo dd of=/dev/rdisk2 bs=32m

epoch1970
Posts: 4465
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: dd takes so long...

Mon Aug 14, 2017 9:29 am

OS X, I don't know what pv does but ctrl-t in the window that runs dd will print the amount of data transferred.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

whatTodo
Posts: 5
Joined: Sun Aug 04, 2019 3:44 am

Re: dd takes so long...

Thu Aug 22, 2019 6:03 pm

I did the recommended command here

Code: Select all

sudo dd bs=4m if=/dev/rdisk2 of=raspbian.img
Took like 30 minutes, maybe less. Top said it was stuck, but after watching it for a while, I noticed it was running; just flipping back and forth. Ctrl-t will send it an info signal that should give you an idea of how much it's done

User avatar
PeterO
Posts: 5623
Joined: Sun Jul 22, 2012 4:14 pm

Re: dd takes so long...

Thu Aug 22, 2019 6:08 pm

whatTodo wrote:
Thu Aug 22, 2019 6:03 pm
Took like 30 minutes, maybe less. Top said it was stuck, but after watching it for a while, I noticed it was running; just flipping back and forth. Ctrl-t will send it an info signal that should give you an idea of how much it's done
For the dd man page
Sending a USR1 signal to a running 'dd' process makes it print I/O statistics to standard error and then resume copying.
I run a shell command that sends a SIGUSR1 to the process dd once a minute so I can see how it is getting on with the job.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
DougieLawson
Posts: 37571
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: dd takes so long...

Thu Aug 22, 2019 7:27 pm

whatTodo wrote:
Thu Aug 22, 2019 6:03 pm

Code: Select all

sudo dd bs=4m if=/dev/rdisk2 of=raspbian.img
Why such a small bs= value. I look at available RAM with TOP and usually set bs= to about 70% of that value. So if the system has 100MB free I'll use bs=70m. You get better I/O rates with a long continous read rather than lots of 4MB reads/4MB writes as it uses less CPU driving the interrupt handler and the context switch (running to readyQ, readyQ to running) as each block is read or written.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Return to “Raspbian”