Memory Card Read/Write Speed

Quick enough

You’ve got a new memory card and you wonder which speed it reads? hdparm will do the trick here for you:

$ sudo hdparm -t /dev/sdb
/dev/sdb:
Timing buffered disk reads:  82 MB in  3.07 seconds =  26.67 MB/sec

$ sudo hdparm -t /dev/sdb
/dev/sdb:
Timing buffered disk reads:  82 MB in  3.05 seconds =  26.86 MB/sec

sudo hdparm -t /dev/sdb
/dev/sdb:
Timing buffered disk reads:  82 MB in  3.06 seconds =  26.77 MB/sec

So my SanDisk card performs with ~26.5 MB/sec. That’s OK for me.

It didn’t matter if I addressed /dev/sdb or /dev/sdb1, the existing file-system wasn’t destroyed.

And as always it’s always neat to read the man page

-t     Perform timings of device reads for benchmark and comparison purposes.
For meaningful results, this operation should be repeated 2-3 times on an
otherwise inactive system (no other active processes) with at least a couple
of megabytes of free memory. This displays the speed of reading through the
buffer cache to the disk without any prior caching of data. This measurement
is an indication of how fast the drive can sustain sequential data reads under
Linux, without any file-system overhead. To ensure accurate measurements, the
buffer cache is flushed during the processing of -t using the BLKFLSBUF ioctl.

As an alternative you can use dd as well and test the writing as well:

$ sudo dd count=1k bs=1M if=/dev/zero of=/dev/sdb
1024+0 oppføringer inn
1024+0 oppføringer ut
1073741824 byte (1,1 GB) kopiert, 50,7091 s, 21,2 MB/s

$ sudo dd count=1k bs=1M if=/dev/zero of=/dev/sdb
1024+0 oppføringer inn
1024+0 oppføringer ut
1073741824 byte (1,1 GB) kopiert, 50,7402 s, 21,2 MB/s

$ sudo dd count=1k bs=1M if=/dev/zero of=/dev/sdb
1024+0 oppføringer inn
1024+0 oppføringer ut
1073741824 byte (1,1 GB) kopiert, 50,7049 s, 21,2 MB/s