J'ai été temté par 2 super cartes micro SD de 1TB vendu par le chinois du coin, dans la boutique Bouhou 66 Store que vous recommande.
SD veut dire Secure Digital, vous allez en avoir une démo.
Si vous achetez des cartes SD, prenez un peu de temps pour vérifier qu'elles sont conforme à ce qu'elles prétendent être. Il y en a des fois qui le sont.
Avant de commencer, soyez prévenu que certaines manips peuvent prendre des heures !
Avec les inscriptions suivantes au dos de la carte:
CE
MMCAX64AC10-T0
YXDLID 9T24 2212
MADE IN TAIWAN
Si on tape MMCAX64AC10-T0 dans un moteur de recherche on tombe sur des cartes sd de 64 GB.
Conscient de l'existence de l'arnaque sur les cartes SD, je commence par tester la capacité de chacune des cartes, dès leur réception. Pour cela il existe sous Linux une suite de programmes qui s'appelle f3 - Fight Flash Fraud que l'on peut télécharger sur le site f3 - Fight Flash Fraud
Après compilation, on dispose d'une commande f3probe que l'on applique au lecteur sur lequel est monté la carte SD et dans mon cas c'est /dev/sdc, en étant root.
# ./f3probe --destructive --time-ops /dev/sdc
Voici le résultat de la commande :
# ./f3probe --destructive --time-ops /dev/sdc >> 1TB-1.txt
F3 probe 8.0
Copyright (C) 2010 Digirati Internet LTDA.
This is free software; see the source for copying conditions.
WARNING: Probing normally takes from a few seconds to 15 minutes, but
it can take longer. Please be patient.
Bad news: The device `/dev/sdc' is a counterfeit of type limbo
You can "fix" this device using the following command:
f3fix --last-sec=122834742 /dev/sdc
Device geometry:
*Usable* size: 58.57 GB (122834743 blocks)
Announced size: 1000.00 GB (2097154048 blocks)
Module: 1.00 TB (2^40 Bytes)
Approximate cache size: 31.00 MB (63488 blocks), need-reset=no
Physical block size: 512.00 Byte (2^9 Bytes)
Probe time: 7'55"
Operation: total time / count = avg time
Read: 15.39s / 131382 = 117us
Write: 7'39" / 639250 = 719us
Reset: 1us / 2 = 0us
La deuxième carte est passée sur une autre machine et sur le lecteur /dev/sdb Voici le résultat :
# ./f3probe --destructive --time-ops /dev/sdb
F3 probe 8.0
Copyright (C) 2010 Digirati Internet LTDA.
This is free software; see the source for copying conditions.
WARNING: Probing normally takes from a few seconds to 15 minutes, but
it can take longer. Please be patient.
Bad news: The device `/dev/sdb' is a counterfeit of type limbo
You can "fix" this device using the following command:
f3fix --last-sec=127141677 /dev/sdb
Device geometry:
*Usable* size: 60.63 GB (127141678 blocks)
Announced size: 1000.00 GB (2097154048 blocks)
Module: 1.00 TB (2^40 Bytes)
Approximate cache size: 1.00 MB (2048 blocks), need-reset=no
Physical block size: 512.00 Byte (2^9 Bytes)
Probe time: 7'40"
Operation: total time / count = avg time
Read: 616.3ms / 4211 = 146us
Write: 7'39" / 22868 = 20.0ms
Reset: 10us / 1 = 10us
Les 2 résultats sont aussi mauvais et ils indiquent qu'il s'agirait de cartes 64 GB avec des défauts.
Les données fournies par fdisk ne sont pas crédibles et laissent penser que l'on a un disque tout à fait normal or on sait déjà que ce n'est pas le cas.
# fdisk -l /dev/sdc >> 1TG-1.txt Disk /dev/sdc: 1000 GiB, 1073742872576 bytes, 2097154048 sectors Disk model: STORAGE DEVICE 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: 0x00000000 Device Boot Start End Sectors Size Id Type /dev/sdc1 32 2097154047 2097154016 1000G c W95 FAT32 (LBA)
La carte SD arrive avec une partition DOS de la taille annoncée. En utilisant la commande f3write, on peut y écrire des fichiers numérotés de taille 1 GB pour la lecture par f3read. Mais il inutile de dépasser le volume annoncé au paragraphe précédent: 60 GB donc 60 fichiers. Voici un début de création de fichiers, qui se passe en général très bien, sur une partition déjà limitée:
# ./f3write /run/media/hq/SD1TB2-1 F3 write 8.0 Copyright (C) 2010 Digirati Internet LTDA. This is free software; see the source for copying conditions. Free space: 58.76 GB Creating file 1.h2w ... OK! Creating file 2.h2w ... OK! Creating file 3.h2w ... 4.88% -- 14.20 MB/s -- 2:33:09
La commande f3read va relire les fichiers créés précédemment et détecter les mauvais blocks et les affichés. On pourra constater si on a affaire a un gruyère ou pas. Voici mon fichier f3read pour une des cartes:
#./f3read /run/media/hq/SD1TB2-1
F3 read 8.0
Copyright (C) 2010 Digirati Internet LTDA.
This is free software; see the source for copying conditions.
SECTORS ok/corrupted/changed/overwritten
Validating file 1.h2w ... 2097152/ 0/ 0/ 0
Validating file 2.h2w ... 2097152/ 0/ 0/ 0
Validating file 3.h2w ... 2097152/ 0/ 0/ 0
Validating file 4.h2w ... 2097152/ 0/ 0/ 0
Validating file 5.h2w ... 2097152/ 0/ 0/ 0
Validating file 6.h2w ... 2097152/ 0/ 0/ 0
Validating file 7.h2w ... 2097152/ 0/ 0/ 0
Validating file 8.h2w ... 2097152/ 0/ 0/ 0
Validating file 9.h2w ... 2097152/ 0/ 0/ 0
Validating file 10.h2w ... 2097152/ 0/ 0/ 0
Validating file 11.h2w ... 2097152/ 0/ 0/ 0
Validating file 12.h2w ... 2097152/ 0/ 0/ 0
Validating file 13.h2w ... 2097152/ 0/ 0/ 0
Validating file 14.h2w ... 2097152/ 0/ 0/ 0
Validating file 15.h2w ... 2097120/ 32/ 0/ 0
Validating file 16.h2w ... 2097152/ 0/ 0/ 0
Validating file 17.h2w ... 2097152/ 0/ 0/ 0
Validating file 18.h2w ... 2097152/ 0/ 0/ 0
Validating file 19.h2w ... 2097152/ 0/ 0/ 0
Validating file 20.h2w ... 2097152/ 0/ 0/ 0
Validating file 21.h2w ... 2097152/ 0/ 0/ 0
Validating file 22.h2w ... 2097152/ 0/ 0/ 0
Validating file 23.h2w ... 2097152/ 0/ 0/ 0
Validating file 24.h2w ... 2097152/ 0/ 0/ 0
Validating file 25.h2w ... 2097152/ 0/ 0/ 0
Validating file 26.h2w ... 2097152/ 0/ 0/ 0
Validating file 27.h2w ... 2097120/ 32/ 0/ 0
Validating file 28.h2w ... 2097152/ 0/ 0/ 0
Validating file 29.h2w ... 2097152/ 0/ 0/ 0
Validating file 30.h2w ... 2097152/ 0/ 0/ 0
Validating file 31.h2w ... 2097152/ 0/ 0/ 0
Validating file 32.h2w ... 2097152/ 0/ 0/ 0
Validating file 33.h2w ... 2097152/ 0/ 0/ 0
Validating file 34.h2w ... 2097152/ 0/ 0/ 0
Validating file 35.h2w ... 2097152/ 0/ 0/ 0
Validating file 36.h2w ... 2097152/ 0/ 0/ 0
Validating file 37.h2w ... 2097152/ 0/ 0/ 0
Validating file 38.h2w ... 2097152/ 0/ 0/ 0
Validating file 39.h2w ... 2097152/ 0/ 0/ 0
Validating file 40.h2w ... 2097152/ 0/ 0/ 0
Validating file 41.h2w ... 2097152/ 0/ 0/ 0
Validating file 42.h2w ... 2097152/ 0/ 0/ 0
Validating file 43.h2w ... 2097120/ 32/ 0/ 0
Validating file 44.h2w ... 2097152/ 0/ 0/ 0
Validating file 45.h2w ... 2097152/ 0/ 0/ 0
Validating file 46.h2w ... 2097152/ 0/ 0/ 0
Validating file 47.h2w ... 2097152/ 0/ 0/ 0
Validating file 48.h2w ... 2097152/ 0/ 0/ 0
Validating file 49.h2w ... 2097120/ 32/ 0/ 0
Validating file 50.h2w ... 2097152/ 0/ 0/ 0
Validating file 51.h2w ... 2097152/ 0/ 0/ 0
Validating file 52.h2w ... 2097152/ 0/ 0/ 0
Validating file 53.h2w ... 2097152/ 0/ 0/ 0
Validating file 54.h2w ... 2097152/ 0/ 0/ 0
Validating file 55.h2w ... 1001271/ 1095881/ 0/ 0
Validating file 56.h2w ... 212992/ 1884160/ 0/ 0
Validating file 57.h2w ... 2088960/ 8192/ 0/ 0
Validating file 58.h2w ... 2097152/ 0/ 0/ 0
Validating file 59.h2w ... 1547344/ 7952/ 0/ 0
Data OK: 57.31 GB (120193799 sectors)
Data LOST: 1.43 GB (2996313 sectors)
Corrupted: 1.43 GB (2996313 sectors)
Slightly changed: 0.00 Byte (0 sectors)
Overwritten: 0.00 Byte (0 sectors)
Average reading speed: 12.81 MB/s
# ./f3fix --last-sec=127141677 /dev/sdb F3 fix 8.0 Copyright (C) 2010 Digirati Internet LTDA. This is free software; see the source for copying conditions. Drive `/dev/sdb' was successfully fixed
On peut constater qu'après f3fix, la taille de la partition est corrigée, mais pas la taille du disque:
# fdisk -l /dev/sdb Disk /dev/sdb: 1000 GiB, 1073742872576 bytes, 2097154048 sectors Disk model: microSD RDR 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: 0x02505795 Device Boot Start End Sectors Size Id Type /dev/sdb1 * 2048 127141677 127139630 60.6G b W95 FAT32
On refait une partition Linux avec la valeur de fin précédent.
# fdisk -l /dev/sdb Disk /dev/sdb: 1000 GiB, 1073742872576 bytes, 2097154048 sectors Disk model: microSD RDR 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: 0xa27db4d4 Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 127928319 127926272 61G 83 Linux
La partition créée peut contenir des badblocks. La commande suivante détecte les badblocks et en tient compte pour la création du filesystem. C'est assez long (2 h).
mkfs.ext4 -L SD1TB2 -c /dev/sdb1
La commande n'a pas vu de badblocks et pourtant le test f3write + f3read ( 3 h + 2 h) en trouve:
F3 read 8.0
Copyright (C) 2010 Digirati Internet LTDA.
This is free software; see the source for copying conditions.
SECTORS ok/corrupted/changed/overwritten
Validating file 1.h2w ... 2097152/ 0/ 0/ 0
Validating file 2.h2w ... 2097120/ 32/ 0/ 0
Validating file 3.h2w ... 2097152/ 0/ 0/ 0
Validating file 4.h2w ... 2097152/ 0/ 0/ 0
Validating file 5.h2w ... 2097152/ 0/ 0/ 0
Validating file 6.h2w ... 2097152/ 0/ 0/ 0
Validating file 7.h2w ... 2097152/ 0/ 0/ 0
Validating file 8.h2w ... 2097152/ 0/ 0/ 0
Validating file 9.h2w ... 2097152/ 0/ 0/ 0
Validating file 10.h2w ... 2097152/ 0/ 0/ 0
Validating file 11.h2w ... 2097152/ 0/ 0/ 0
Validating file 12.h2w ... 2097152/ 0/ 0/ 0
Validating file 13.h2w ... 2097152/ 0/ 0/ 0
Validating file 14.h2w ... 2097152/ 0/ 0/ 0
Validating file 15.h2w ... 2097152/ 0/ 0/ 0
Validating file 16.h2w ... 2097152/ 0/ 0/ 0
Validating file 17.h2w ... 2097152/ 0/ 0/ 0
Validating file 18.h2w ... 2097152/ 0/ 0/ 0
Validating file 19.h2w ... 2097152/ 0/ 0/ 0
Validating file 20.h2w ... 2097152/ 0/ 0/ 0
Validating file 21.h2w ... 2097152/ 0/ 0/ 0
Validating file 22.h2w ... 2097152/ 0/ 0/ 0
Validating file 23.h2w ... 2097152/ 0/ 0/ 0
Validating file 24.h2w ... 2097152/ 0/ 0/ 0
Validating file 25.h2w ... 2097152/ 0/ 0/ 0
Validating file 26.h2w ... 2097152/ 0/ 0/ 0
Validating file 27.h2w ... 2097152/ 0/ 0/ 0
Validating file 28.h2w ... 2097152/ 0/ 0/ 0
Validating file 29.h2w ... 2097152/ 0/ 0/ 0
Validating file 30.h2w ... 2097152/ 0/ 0/ 0
Validating file 31.h2w ... 2097152/ 0/ 0/ 0
Validating file 32.h2w ... 2097152/ 0/ 0/ 0
Validating file 33.h2w ... 2097152/ 0/ 0/ 0
Validating file 34.h2w ... 2097152/ 0/ 0/ 0
Validating file 35.h2w ... 2097152/ 0/ 0/ 0
Validating file 36.h2w ... 2097152/ 0/ 0/ 0
Validating file 37.h2w ... 2097152/ 0/ 0/ 0
Validating file 38.h2w ... 2097152/ 0/ 0/ 0
Validating file 39.h2w ... 2097152/ 0/ 0/ 0
Validating file 40.h2w ... 2097152/ 0/ 0/ 0
Validating file 41.h2w ... 2097152/ 0/ 0/ 0
Validating file 42.h2w ... 2097152/ 0/ 0/ 0
Validating file 43.h2w ... 2097152/ 0/ 0/ 0
Validating file 44.h2w ... 2097152/ 0/ 0/ 0
Validating file 45.h2w ... 2097152/ 0/ 0/ 0
Validating file 46.h2w ... 2097152/ 0/ 0/ 0
Validating file 47.h2w ... 2097152/ 0/ 0/ 0
Validating file 48.h2w ... 2097152/ 0/ 0/ 0
Validating file 49.h2w ... 2097152/ 0/ 0/ 0
Validating file 50.h2w ... 2097152/ 0/ 0/ 0
Validating file 51.h2w ... 2097152/ 0/ 0/ 0
Validating file 52.h2w ... 2097152/ 0/ 0/ 0
Validating file 53.h2w ... 2097152/ 0/ 0/ 0
Validating file 54.h2w ... 2097152/ 0/ 0/ 0
Validating file 55.h2w ... 984887/ 1112265/ 0/ 0
Validating file 56.h2w ... 0/ 2097152/ 0/ 0
Validating file 57.h2w ... 0/ 2097152/ 0/ 0
Validating file 58.h2w ... 491520/ 1605632/ 0/ 0
Validating file 59.h2w ... 2097152/ 0/ 0/ 0
Validating file 60.h2w ... 2088960/ 8192/ 0/ 0
Validating file 61.h2w ... 1285184/ 204296/ 0/ 0
Data OK: 57.31 GB (120193879 sectors)
Data LOST: 3.40 GB (7124721 sectors)
Corrupted: 3.40 GB (7124721 sectors)
Slightly changed: 0.00 Byte (0 sectors)
Overwritten: 0.00 Byte (0 sectors)
Average reading speed: 11.04 MB/s
Pour compléter la liste des badblocks en cours d'utilisation de la carte SD, la commande suivante read/write non destructive sera complémntaire de la précédente. Essayons:
# fsck -vcck /dev/sdb1
Après 5 heures,on arrête car rien n'est détecté. fsck -vcck n'est pas concluant.
# fsck -vcck /dev/sdc1 fsck from util-linux 2.38.1 e2fsck 1.46.5 (30-Dec-2021) Checking for bad blocks (non-destructive read-write test) Testing with random pattern: 62.82% done, 4:51:27 elapsed. (0/0/0 errors)
On fait une dernière tentative avec badblocks avec l'option -b 4096 pour la prise en compte par fsck. A 1 % on est déjà à 12 minutes. Il faudra donc 1200 minutes soit 20 h (pour 60 GB). On devrait au moins voir les blocks corrupted de 2.h2w.
# badblocks -b 4096 -wsv -o /root/badblocks.txt /dev/sdc Checking for bad blocks in read-write mode From block 0 to 262144255 Testing with pattern 0xaa: 1.02% done, 12:39 elapsed. (0/0/0 errors)
On commence par faire un peu de place parce que f3write a écrit jusqu'à la limite du filesystem. On copie un fichier, le premier qui tombe sous la main, ici c'est un iso. On fait des md5sum et pour terminer on monte les 2 fichiers iso sur des réperaoires puis on fait un diff récursif des 2 répertoires. on constate les dégats. Le fichier est choisi en connaissance de cause en fonction du résulat f3read précédent.
# fichier initial créé par f3write- un md5sum pour voir si il est changé. md5sum /a/56.h2w cd573cfaace07e7949bc0c46028904ff /a/56.h2w # fichier que l'on va copier $ md5sum /home7/void-mklive/void-live-x86_64-musl-6.0.11_1-20221207.iso eec24ac3c0c01b8a51fc781851389b3b /home7/void-mklive/void-live-x86_64-musl-6.0.11_1-20221207.iso # copie du fichier cp /home7/void-mklive/void-live-x86_64-musl-6.0.11_1-20221207.iso /a/56.h2w cp /a/56.h2w /home7 # ls -l /a/56.h2w /home7/56.h2w -rw-r--r-- 1 root root 1265106944 Dec 30 16:04 /a/56.h2w -rw-r--r-- 1 root root 1265106944 Dec 30 16:14 /home7/56.h2w # checksum du fichier : il est modifié donc mauvais et inutilisable. # md5sum /a/56.h2w /home7/56.h2w /home7/void-mklive/void-live-x86_64-musl-6.0.11_1-20221207.iso a5391df4dfe0cf7f9095d13caca01a79 /a/56.h2w a5391df4dfe0cf7f9095d13caca01a79 /home7/56.h2w eec24ac3c0c01b8a51fc781851389b3b /home7/void-mklive/void-live-x86_64-musl-6.0.11_1-20221207.iso # mount /home7/56.h2w /mnt # mount /home7/void-mklive/void-live-x86_64-musl-6.0.11_1-20221207.iso /b diff -r /b /mnt >& log # cat log # nice corruption : many files unusables !# Binary files /b/LiveOS/squashfs.img and /mnt/LiveOS/squashfs.img differ Binary files /b/boot/grub/fonts/unicode.pf2 and /mnt/boot/grub/fonts/unicode.pf2 differ Binary files /b/boot/grub/grub_void.cfg and /mnt/boot/grub/grub_void.cfg differ Binary files /b/boot/initrd and /mnt/boot/initrd differ Binary files /b/boot/isolinux/chain.c32 and /mnt/boot/isolinux/chain.c32 differ Binary files /b/boot/isolinux/isolinux.cfg and /mnt/boot/isolinux/isolinux.cfg differ Binary files /b/boot/isolinux/ldlinux.c32 and /mnt/boot/isolinux/ldlinux.c32 differ Binary files /b/boot/isolinux/libcom32.c32 and /mnt/boot/isolinux/libcom32.c32 differ Binary files /b/boot/isolinux/libutil.c32 and /mnt/boot/isolinux/libutil.c32 differ Binary files /b/boot/isolinux/splash.png and /mnt/boot/isolinux/splash.png differ Binary files /b/boot/isolinux/vesamenu.c32 and /mnt/boot/isolinux/vesamenu.c32 differ Binary files /b/boot/vmlinuz and /mnt/boot/vmlinuz differ
Conclusion : inutilisable. Le minimum demandé, c'est une copie à l'identique. On est sur une partition de 60 GB et je ne parle pas des 940 GB restant !
Pour voir ce qui se passe au dela de la première partotion, il suffit d'en créer une deuxième. j'en ai ctéeé une de 10 GB avec fdisk et elle s'appelle /dev/sdc2. Formattons la et essauons de la monter
# mkfs.ext4 -L SD1TB2 /dev/sdc2
mke2fs 1.46.5 (30-Dec-2021)
Creating filesystem with 2621440 4k blocks and 655360 inodes
Filesystem UUID: 7e9b03f2-031f-43af-a199-936d8748c5ae
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
# mount /dev/sdc2 /a
mount: /a: wrong fs type, bad option, bad superblock on /dev/sdc2, missing codepage or helper program, or other error.
dmesg(1) may have more information after failed mount system call.
Le formatage passe, mais le mount trépasse... Il n'y a plus rien après les 60 GB.
Les résultats f3read montre 32 blocks corrupted de façon aléatoire. Je n'ai pas réussi à reproduire avec mon fichier iso de test. Par contre il y a des choses qui changent si on joue à coté, c'est à dire, si on essaie de dépasser les 50 GB , c'st ce que l'on fait lorsque on laisse tourner f3read, ou en créant une dueuxième partition.
La partition est remplie avec des copies de mon fichier iso. 2 des fichiers ont un mauvais checksum. On essaie ensuite la 2 ième partition et les checksum changent sur les 2 fichiers mauvais. Le deuxième block semble partiellement lié au premier. F3write n'est peut être pas arrêté assez tôt.
... eec24ac3c0c01b8a51fc781851389b3b /a/f40.iso 3793859e9f1a512d7ae9304ecafc9b85 /a/f41.iso 8526057837f488cef3eb5de950e40a51 /a/f42.iso eec24ac3c0c01b8a51fc781851389b3b /a/f43.iso ... # après quelques test...essai 2 ième partition ... eec24ac3c0c01b8a51fc781851389b3b /a/f40.iso 0f16bd02da9fcf0b6dc88cb20570cb18 /a/f41.iso 8526057837f488cef3eb5de950e40a51 /a/f42.iso eec24ac3c0c01b8a51fc781851389b3b /a/f43.iso ...
Il manque certainement quelques bits d'adressage à cette mémoire. Elle a certainement été créée pour 64 GB, réjectée parce qu'il y a des défaults sur le premiers 64 GB, récupérée et trafiquée pour montrer 16 * 64 GB et vendue comme telle.
Il est vrai que pour Void Linux musl, il existe un paquet f3 qu'il suffit d'installer. Mais ayant déjà, les sources, pour compiler il faut installer le paquet argp-standalone et modifier le Makefile pour ajouter un LDFLAGS += -largp
Ces cartes SD ressemblent à des déchets de fabrication récupérées par des faussaires. Les label et données apparentes sont modifiés, mais derrière il manque la mémoire effective. Cela en fait un parfait fake.
Aucun succès n'a été obtenu avec les commandes fsck, mkfs, badblocks pour la gestion des erreurs, peut être en rapport avec la technologie SD.