Category: dd

Raspberry Pi: how to clone a SD card

I had to clone a SD card for my Raspberry Pi. DiskDump (dd) did the job.

Source: sdc, destination: sdi

dd if=/dev/sdc of=/dev/sdi bs=8M

dd has not a verbose output but we can get some progress information sending periodically the SIGUSR1 signal

watch -n2 "sudo kill -SIGUSR1 $(pidof dd)"

The output every 2 seconds:

7969177600 bytes (8.0 GB) copied, 587.801 s, 13.6 MB/s
954+0 records in
953+0 records out
7994343424 bytes (8.0 GB) copied, 590.067 s, 13.5 MB/s
957+0 records in
956+0 records out
8019509248 bytes (8.0 GB) copied, 591.918 s, 13.5 MB/s
960+0 records in
959+0 records out
8044675072 bytes (8.0 GB) copied, 593.774 s, 13.5 MB/s
961+1 records in
961+1 records out
8068792320 bytes (8.1 GB) copied, 595.125 s, 13.6 MB/s

How to benchmark sd card read/write speeds

I just got some 8GB SD cards from Hong Kong sold as CLASS 6, so I thought it was a good idea to test their performances.

Insert the sd card into the reader and mount it. We assume the device will be /dev/sdb mounted as /media/8gb.

Firstly check the read speed through the hdparm command using the option -tPerform device read timings

$ sudo hdparm -t /dev/sdb
/dev/sdb:
 Timing buffered disk reads:   58 MB in  3.08 seconds =  18.81 MB/sec

Then when test the write speed with dd writing approx 1GB of data to the disk. This large number is because the filesystem on the device will speed up the transfer by caching the data if a small transfer is carried out.

$ dd count=1024 bs=1M if=/dev/zero of=/media/8gb/testfile
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 79.4985 s, 13.5 MB/s

At the end the SD card performances are:

  • Read: 18 MB/sec
  • Write: 13 MB/sec

This values are aligned with a good CLASS 6 sd card. Luckily I wasn’t cheated.

WordPress Themes