Testing be a SD card under linux
SD cards are a common target for product forgery. Many cards on the market (be it eBay or retailers) are rebranded. have fake capacity or are simply bad ones initially removed from production that are resold afterwards by third parties. Bunnie has an excellent article on fake SD cards and how to test them. For more info on SD cards. check out this flash card survey.
I recently bought an SD card from Sandisk, discount canada goose work gloves
. one of the biggest target for forgeries. It was labeled “Sandisk 16GB class 4 Micro SDHC memory card”. I bought it on eBay. it was coming from China. and it was cheap (16GB for 8€ including shipping) authentic canada goose jackets dead coyotes . Of course. I wanted to make sure that I got a good one. so I ran a couple of tests. (BTW. I guess the best up-front-protection against fakes is not to buy the cheapest offer on the market. )
Here’s what I did under Ubuntu Linux for testing my card. I ran two tests. one for the performance using flashbench canada goose jackets dead coyotes . and another one to do a full-write test in order to reveal capacity problems. My laptop only has a USB card reader canada goose jackets dead coyotes buy . so that I cannot read the manufacturer and other info of the card. Not the best for testing. but well canada goose jackets dead coyotes .
Attention buy canada goose jackets dead coyotes . the example below writes to /dev/sdb. which is the device for the card in my case. In your case. it might well be a disk. Make sure that you use the proper device (often something like /dev/mmcblk1 if you have a real card reader).
Running flashbench canada goose jackets dead coyotes .
$. /test_sd_card. sh /dev/sdb
4MiB 10. 9M/s
2MiB 4. 06M/s
1MiB 4. 05M/s
512KiB 2 canada goose jackets dead coyotes buy . 73M/s
256KiB 1. 99M/s
So, canada goose citadel jacket store
. looking at the flashbench wiki this seems to be fairly reasonable for a class 4 card.
Next doudoune canada goose geneve outlet . I did the full-write test canada goose kensington grey parka discount on sale . to see if the card was actually had the promised capacity. Obviously. you need a bit of space on your disk for this. We’re creating a random data file. write it to the SD card. read it back. and check for differences.
Create a file with the required capacity. filled with random data. We’re writing blocks of 1024 bytes, real canada goose stores in halifax
. so adjust the count to the capacity required (16GB in my case).
dd if=/dev/urandom of=rnd_init_data bs=1024 count=16000000
Now. we write the data to the SD card canada goose chilliwack bomber ssense online store .
$ dd if=rnd_init_data of=/dev/sdb bs=1024 count=16000000
15558145+0 records in
15558144+0 records out
15931539456 bytes (16 GB) copied. 536. 286 s. 29. 7 MB/s
You can see. we didn’t manage to write all the bytes to the card. This is expected. as we don’t know the capacity of the card down to the last byte. As long as the capacity reported by dd (16 GB) is close to the expected result buy canada goose in uk online store . we’re happy.
Now. we copy the bytes written to a new file. which we use for later comparison. Notice here the count. which we adapted to the bytes written to the card (15931539456 / 1024 = 15558144). I am sure this can be done easier using tools like truncate. but I didn’t want to start messing with programs that I don’t know by heart.
$ dd if=rnd_init_data of=rnd_written_data bs=1024 count=15558144
$ rm -f rnd_init_data
Read back the data from the card.
$ dd if=/dev/sdb of=rnd_read_data bs=1024 count=15558144
Finally. we’re comparing the two data files.
$ md5sum rnd*
Et voilà. my card is genuine (or at least does neither have abysmal performance nor fake capacity). Yay. I’ve been lucky canada goose in boston ma for sale .
Don’t forget to clean up (remove files manteau canada goose whistler sales . reformat card).
$ rm -f rnd_written_data rnd_read_data
$ fdisk /dev/sdb # keys. o. n. p. 1. . t. c. w
$ mkfs. vfat -F 32 /dev/sdb1
(The fdisk line creates a single primary FAT32 partition on the card canada goose shops deutschland outlet online . ). canada goose jackets dead coyotes