Sunday, June 23, 2013

Sunday, June 16, 2013

Copy Raspbian image to SD card with progress bar and /dev/rdisk

While going through these steps to install Raspbian onto my SD card I found that the dd command takes quite some time and gives zero feedback on progress. At first I used /dev/disk1 as my destination path but using the raw path /dev/rdisk1 increased the speed 5x! Adding pv into the mix provided a nice progress bar:
  1. install pv (brew install pv does the trick on a Mac, apt-get install pv will probably do the trick on Linux)
  2. then, instead of sudo dd if=/path/2013-05-29-wheezy-armel.img of=/dev/rdisk1 bs=1m (or something similar) just pull the file through pv and pipe it into dd, like so:
  3. pv -tpreb /path/2013-05-29-wheezy-armel.img | sudo dd of=/dev/rdisk1 bs=1m
And you will get something like:
 275MiB 0:00:29 [11.3MiB/s] [=====>                                          ] 14% ETA 0:02:45

Lovely! :)

Now, compare that to using /dev/disk1 (not the raw path) and you'll notice the transfer rate being much lower.
 621MiB 0:05:33 [2.09MiB/s] [=============>                        ] 33% ETA 0:10:58