dimanche 7 décembre 2014

F3: tester des périphériques de stockage (SD ou USB) sous Linux

Lumière sur le projet F3 (oss.digirati.com.br/f3), ce dernier permet de tester des cartes SD/USB stick.
Le programme est relativement simple et se compose de deux utilitaires f3write (pour écrire des fichiers de tests) et f3read pour effectuer les tests de lecture.

Petite présentation par l'auteur

F3 - une alternative à h2testw
Ce projet à commencé lorsque Michel Machado de F3 à acheté une carte de 32GB microSDHC pour son Android (c'était en 2010). Il a remarqué que la carte présentait toujours des défaillances lorsqu'elle était remplie. En faisant quelques recherches sur Google, il est arrivé sur les blogs Fight Flash Fraud et SOSFakeFlash qui recommande tout deux l'usage du logiciel H2testw (voir ici ou ici) pour tester les mémoires flashs.
Michel à téléchargé H2testw et à été immédiatement confronté a deux problèmes:
  1. H2testw est logiciel Windows uniquement
  2. H2testw n'est pas un logiciel open-source.
Cependant, Harald Bögeholz (l'auteur de H2testw), est assez sympa pour inclure un fichier texte décrivant comment fonctionne son programme (ainsi que le générateur de nombre aléatoire).

Ainsi naquis F3 et sa page oss.digirati.com.br/f3 qui est l'implémentation GPLv3 de H2testw réalisé par Michel Machado. Version qui fonctionne sous Linux, Macs, Windows/Cygwin et FreeBSD.
Cette implémentation s'appelle F3, qui est le raccourci de "Fight Flash Fraud" ou "Fight Fake Flash".

Comment installer F3 sous Linux
Si vous diposez d'Ubuntu ou un de ses dérivé (ex: Linux Mint), un simple apt-get fera l'affaire :-)

sudo apt-get install f3

Utiliser f3
F3 se compose de deux programme f3write et f3read.
F3write est destiné à remplir votre périphérique avec des fichiers de données (attention, il rempli l'espace disponible). f3write remplit le système de fichier avec des fichiers de 1GB nommés N.h2w, où N est un numér.
F3read relit les fichiers et fait une validation du contenu, c'est ainsi que l'on détecte les corruptions.

Voici un exemple pratique (par l'auteur)
$ ./f3write /media/5EBD-5C80/
Free space: 28.83 GB
Creating file 1.h2w ... OK!
Creating file 2.h2w ... OK!
Creating file 3.h2w ... OK!
Creating file 4.h2w ... OK!
Creating file 5.h2w ... OK!
Creating file 6.h2w ... OK!
Creating file 7.h2w ... OK!
Creating file 8.h2w ... OK!
Creating file 9.h2w ... OK!
Creating file 10.h2w ... OK!
Creating file 11.h2w ... OK!
Creating file 12.h2w ... OK!
Creating file 13.h2w ... OK!
Creating file 14.h2w ... OK!
Creating file 15.h2w ... OK!
Creating file 16.h2w ... OK!
Creating file 17.h2w ... OK!
Creating file 18.h2w ... OK!
Creating file 19.h2w ... OK!
Creating file 20.h2w ... OK!
Creating file 21.h2w ... OK!
Creating file 22.h2w ... OK!
Creating file 23.h2w ... OK!
Creating file 24.h2w ... OK!
Creating file 25.h2w ... OK!
Creating file 26.h2w ... OK!
Creating file 27.h2w ... OK!
Creating file 28.h2w ... OK!
Creating file 29.h2w ... OK!
Free space: 0.00 Byte
Average Writing speed: 2.60 MB/s

$ ./f3read /media/5EBD-5C80/
                  SECTORS      ok/corrupted/changed/overwritten
Validating file 1.h2w ...       0/  2097152/      0/      0
Validating file 2.h2w ...       0/  2097152/      0/      0
Validating file 3.h2w ...       0/  2097152/      0/      0
Validating file 4.h2w ...       0/  2097152/      0/      0
Validating file 5.h2w ...       0/  2097152/      0/      0
Validating file 6.h2w ...       0/  2097152/      0/      0
Validating file 7.h2w ...       0/  2097152/      0/      0
Validating file 8.h2w ...       0/  2097152/      0/      0
Validating file 9.h2w ...       0/  2097152/      0/      0
Validating file 10.h2w ...       0/  2097152/      0/      0
Validating file 11.h2w ...       0/  2097152/      0/      0
Validating file 12.h2w ...       0/  2097152/      0/      0
Validating file 13.h2w ...       0/  2097152/      0/      0
Validating file 14.h2w ...       0/  2097152/      0/      0
Validating file 15.h2w ...       0/  2097152/      0/      0
Validating file 16.h2w ...       0/  2097152/      0/      0
Validating file 17.h2w ...       0/  2097152/      0/      0
Validating file 18.h2w ...       0/  2097152/      0/      0
Validating file 19.h2w ...       0/  2097152/      0/      0
Validating file 20.h2w ...       0/  2097152/      0/      0
Validating file 21.h2w ...       0/  2097152/      0/      0
Validating file 22.h2w ...       0/  2097152/      0/      0
Validating file 23.h2w ...       0/  2097152/      0/      0
Validating file 24.h2w ... 1916384/   180768/      0/      0
Validating file 25.h2w ...  186816/  1910336/      0/      0
Validating file 26.h2w ...       0/  2097152/      0/      0
Validating file 27.h2w ...       0/  2097152/      0/      0
Validating file 28.h2w ...       0/  2097152/      0/      0
Validating file 29.h2w ...   28224/  1705280/      0/      0

  Data OK: 1.02 GB (2131424 sectors)
Data LOST: 27.81 GB (58322336 sectors)
        Corrupted: 27.81 GB (58322336 sectors)
 Slightly changed: 0.00 Byte (0 sectors)
      Overwritten: 0.00 Byte (0 sectors)
Average Reading speed: 9.54 MB/s

L'exemple ci-dessus indique que la carte Flash est sacrément corrompue. Plus de 27Go de données sont corrompu.

Localiser le /media
Comme vous pouvez le constater dans l'exemple, la carte SD est montée dans le répertoire /media. Le périphérique est directement accessible via /media/5EBD-5C80/
La valeur 5EBD-5C80 change d'un périphérique Flash à l'autre....

Chez MCHobby, nous sommes plutôt accros à Linux Mint. Dans ce cas, la carte SD n'est pas montée dans /media/5EBD-5C80 mais dans /media/votre_login_utilisateur/5EBD-5C80

Aucun commentaire: