Thursday, December 24, 2015

Copying Images from Disk to SD Cards

I've been using the dd command to copy images to SD cards for my Raspberry Pi's. I've found a faster way that takes 2+ minutes versus 11+ minutes.

Old way

dd bs=4M if=2015-05-05-raspbian-wheezy.img | pv --size=3276800000 | dd of=/dev/sdX && sync

3.05GB 0:11:25 [4.56MB/s]

New way

pv --size=3276800000 2015-05-05-raspbian-wheezy.img > /dev/sdX && sync

3.05GB 0:02:30 [20.8MB/s]

NOTES: I prep the SD card before the copy with these steps:

  • Become root sudo su
  • Un-mount the SD card. umount /media/SOMEUSER/SOMEMOUNT
  • Find the drive letter for the SD card. I use the command lsblk and/or the GUI gnome-disks. Make sure you double-check your drive letter. dd will destroy anything in its path. I've used sdX in my examples.
  • Wipe the SD card: dd if=/dev/zero of=/dev/sdX bs=512 count=1 conv=notrunc
Tests performed with Ubuntu 14.04, SanDisk SDHC I 32GB, Lexar USB 3.0 adapter.

No comments: