Finding Out Chinese Flash disk/SDHC Card Real Size

Posted by Vasiliy Kaygorodov on Sat 12 December 2015

If you’re interested in pure numbers - scroll down to the Conclusion section.

Recently I bought 2 SDHC cards from a Chinese shop. The price was around $11 for 2, so could not help myself, also I did need to extend my music player storage capacity since some time already. Anyway, I placed order, wait for 2 weeks and the cards arrived.

microsd1

As you can see, the seller included a USB card reader as a gift. Nice. I do know though, that Chinese sellers sometimes sell cards that are not able to hold the specified amount of data, so before I started to actually use the cards, I decided to test them for real capacity. Quick googling revealed F3 utility by Michel Machado, which fills the storage with 1GB files, and then reads written files, and calculates the real size that a storage is able to hold.

Lab environment

I’m using Fedora 21, with 4.1.13-100.fc21.x86_64 kernel. I decided to test the cards simultaneously. One - using the laptop built-in card reader, and the other one - using the supplied microSD-to-SD adapter. I inserted the first card - small LED on the card reader started to blink. Good, let’s see if kernel actually recognized something:

$ dmesg
[911452.253769] usb 4-1.8.6: new high-speed USB device number 23 using ehci-pci
[911452.340726] usb 4-1.8.6: New USB device found, idVendor=14cd, idProduct=1212
[911452.340733] usb 4-1.8.6: New USB device strings: Mfr=1, Product=3,
SerialNumber=2
[911452.340736] usb 4-1.8.6: Product: Mass Storage Device
[911452.340739] usb 4-1.8.6: Manufacturer: Generic
[911452.340742] usb 4-1.8.6: SerialNumber: 121220130416
[911452.341315] usb-storage 4-1.8.6:1.0: USB Mass Storage device detected
[911452.342240] scsi host13: usb-storage 4-1.8.6:1.0
[911453.342765] scsi 13:0:0:0: Direct-Access     Mass     Storage Device   1.00
PQ: 0 ANSI: 0 CCS
[911453.343305] sd 13:0:0:0: Attached scsi generic sg2 type 0
[911453.982671] sd 13:0:0:0: [sdb] 131074048 512-byte logical blocks: (67.1
GB/62.5 GiB)
[911453.983336] sd 13:0:0:0: [sdb] Write Protect is off
[911453.983358] sd 13:0:0:0: [sdb] Mode Sense: 03 00 00 00
[911453.983993] sd 13:0:0:0: [sdb] No Caching mode page found
[911453.984001] sd 13:0:0:0: [sdb] Assuming drive cache: write through
[911453.988255]  sdb: sdb1
[911453.991071] sd 13:0:0:0: [sdb] Attached SCSI removable disk

Yep, got /dev/sdb1. Okay, time to insert second card into the adapter, and put this sandwich to the built-in card reader of my laptop. Did this - and nothing happened, dmesg stayed silent. This means that adapter does not work. Bummer. Well, let’s try another adapter. This time dmesg showed some activity:

[912390.957829] mmc0: card never left busy state
[912390.957837] mmc0: error -110 whilst initialising SD card
[912391.581107] mmc0: new high speed SDXC card at address 21e7
[912391.961174] mmcblk0: mmc0:21e7 APPSD 62.5 GiB 
[912391.961809] mmcblk0: error -84 transferring data, sector 0, nr 8, cmd
response 0x900, card status 0xb00
[912392.576741] mmc0: tried to reset card
[912392.577077] mmcblk0: error -84 transferring data, sector 0, nr 8, cmd
response 0x900, card status 0xb00
...
[912392.579662] Buffer I/O error on dev mmcblk0, logical block 0, async page read

Hmm, second adapter does not seem to work as well… Nice try, but I happen to have another one, that I’m 100% sure works:

microsd2

This time it worked like a charm:

[912688.228461] mmc0: card 21e7 removed
[912743.785554] mmc0: new high speed SDXC card at address 21e7
[912743.786122] mmcblk0: mmc0:21e7 APPSD 62.5 GiB 
[912743.787234]  mmcblk0: p1

Got /dev/mmcblk0p1.

Looking around

Now, let’s see what we’ve got.

$ lsusb
...
Bus 004 Device 023: ID 14cd:1212 Super Top microSD card reader (SY-T18)
Bus 001 Device 002: ID 2635:0601  
...

First one is the USB-microSD reader (/dev/sdb), the other one is my built-in SD card reader (/dev/mmcblk0).

$ sudo fdisk -l /dev/sdb

Disk /dev/sdb: 62.5 GiB, 67109912576 bytes, 131074048 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x21a1f213

Device     Boot Start       End   Sectors  Size Id Type
/dev/sdb1  *      686 131041279 131040594 62.5G  c W95 FAT32 (LBA)
$ sudo fdisk -l /dev/mmcblk0 

Disk /dev/mmcblk0: 62.5 GiB, 67109912576 bytes, 131074048 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x04325a5f

Device         Boot Start       End   Sectors  Size Id Type
/dev/mmcblk0p1 *      686 131041279 131040594 62.5G  c W95 FAT32 (LBA)

Everything seems to be in order - both cards report 62.5G partitions to the kernel. Well, I don’t believe it, so time to …

Fight Fake Flash (or F3)

TL;DR, open 2 consoles and run:

1st console:

$ sudo dnf install f3
$ sudo mkdir -p /mnt/sdb1
$ sudo mount /dev/sdb1 /mnt/sdb1
$ sudo f3write /mnt/sdb1/

2nd console:

$ sudo mkdir -p /mnt/mmcblk0
$ sudo mount /dev/mmcblk0p1 /mnt/mmcblk0/
$ sudo f3write /mnt/mmcblk0/

Now go get some drink, because the process will take some time (around 2-4 hours, depending on your USB ports and adapters/reader you use).

After some time you’ll see output similar to this:

Free space: 62.47 GB
Creating file 0001.fff ... OK!
Creating file 0002.fff ... OK!
...
Creating file 0062.fff ... OK!
Creating file 0063.fff ... OK!
Free space: 0.00 Byte
Average writing speed: 6.77 MB/s

This means the process finished just fine. You can see that though I’m using USB 2.0 ports, and the seller was claiming that those cards are Class 10 cards - average writing speed is a bit slow (should be close to 10 MB/s, according to Wikipedia). I’ve got 5.01 MB/s on the card connected with the USB dongle, and 6.77 MB/s on the card connected via adapter and built-in card reader. Anyways, let’s look at the files that were written:

$ ls -la /mnt/sdb1/
total 65504292
drwxr-xr-x   2 root root      32768 Dec 11 21:31 .
drwxr-xr-x. 15 root root       4096 Dec 11 15:24 ..
-rwxr-xr-x   1 root root 1073741824 Dec 11 15:32 0001.fff
-rwxr-xr-x   1 root root 1073741824 Dec 11 15:38 0002.fff
...
-rwxr-xr-x   1 root root 1073741824 Dec 11 21:26 0061.fff
-rwxr-xr-x   1 root root 1073741824 Dec 11 21:31 0062.fff
-rwxr-xr-x   1 root root  504365056 Dec 11 21:34 0063.fff

As you can see, filesystem reports the correct filesizes too. Time to see how much data was actually written to the media. Again. 1st console:

$ sudo f3read /mnt/sdb1/

2nd console:

$ sudo f3read /mnt/mmcblk0/

Go get another drink, since the process will be twice as slower now. After some time you’ll see the output similar to this:

$ sudo f3read /mnt/sdb1/                                                                                                                             [39/1992]
                     SECTORS      ok/corrupted/changed/overwritten
Validating file 0001.fff ...       0/  2097152/      0/      0
Validating file 0002.fff ...       0/  2097152/      0/      0
...
Validating file 0062.fff ...  979127/  1118025/      0/      0
Validating file 0063.fff ...   51017/   934071/      0/      0

  Data OK: 7.19 GB (15079040 sectors)
Data LOST: 55.28 GB (115929472 sectors)
               Corrupted: 55.28 GB (115929472 sectors)
        Slightly changed: 0.00 Byte (0 sectors)
             Overwritten: 0.00 Byte (0 sectors)
Average reading speed: 2.70 MB/s

We’re interested in Data OK: line, which was 7.19 GB (15079040 sectors) for both cards for me. As a side note, reading speeds are also not overwhelming: 2.68 MB/s on the USB dongle card, and 2.70 MB/s on the one in the card reader.

Conclusion

In the table below I show the result of my small testing.

  • Card1 is the card connected using USB card reader shipped with both cards.
  • Card2 is the card connected using 3rd-party microSD-to-SD adapter, through my laptop built-in card reader.
------+-----------------+-----------------+-----------------
      | Writing (MB/s)  | Reading (MB/s)  |    Size (GB)
 Card +----------+------+----------+------+----------+------
      | Promised | Real | Promised | Real | Promised | Real
------+----------+------+----------+------+----------+------
Card1 | 10       | 5.01 | 5        | 2.70 | 64       | 7.19
Card2 | 10       | 6.77 | 5        | 2.68 | 64       | 7.19
------+----------+------+----------+------+----------+------

What next?

f you got some flash disk drive/SD card from a seller, and after the tests it appears that the real amount of data is far less then it was advertised, you can do 3 things:

  • start a dispute with the seller to get a refund
  • format the storage and create the partition of the size slightly smaller than the reported by F3 tool
  • don’t put any important data on this card

I will write a separate posts about above points, and link them here as soon as they’re ready.

PS

While waiting for both f3write commands to complete, I did read F3 page, and found that this project needs help. (See Help wanted section). A minimum you can do - is to star F3 project on GitHub. And I already sent the link to this article to Michel, hopefully he will find it useful and add it to the his doc.