How to test MicroSD card?

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
What's a good way to test a MicroSD card? I suspect it may be faulty,
but I haven't been able to catch it in the act of going wrong.

I can test in-situ in a Pi, in my MacBook.

Daniele

Re: How to test MicroSD card?
On 09/09/18 10:54, D.M. Procida wrote:
Quoted text here. Click to load it
If the SD card supports SMART that is a good place to start.


--  
Canada is all right really, though not for the whole weekend.

"Saki"

Re: How to test MicroSD card?
On Sun, 9 Sep 2018 10:54:16 +0100,
real-not-anti-spam-address@apple-juice.co.uk (D.M. Procida) wrote:

Quoted text here. Click to load it

You can read thewhole card on the Pi it is used in.
Open a terminal and type:

  lsblk

The response will be something like:

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
mmcblk0     179:0    0   7.4G  0 disk
+-mmcblk0p1 179:1    0  41.8M  0 part /boot
+-mmcblk0p2 179:2    0   7.4G  0 part /


Now read the whole disk, all partitions with:

  sudo dd if=/dev/mmcblk0 of=/dev/null bs=1M

If there are any problems, error messages will show up.
Otherwise, the number of records (blocks) in and out will be reported,
plus the effective duration and speed.

Quoted text here. Click to load it

Hope this helps.

--  
Regards,
Kees Nuyt


Re: How to test MicroSD card?

Quoted text here. Click to load it

Indeed it does - dozens of errors (so far), for the same inodes.

I think the card has reached the end of its life here.

Daniele

Re: How to test MicroSD card?

Quoted text here. Click to load it

When the card is in a Pi, that command will either produce errors or
actually freeze the Pi. Inserted into my MacBook, the same operation
(copying to /dev/null) works without issue.

Daniele

Re: How to test MicroSD card?
On Sun, 09 Sep 2018 22:45:35 +0100, D.M. Procida wrote:

Quoted text here. Click to load it
Which says that the card is still physically undamaged, or at least has  
enough undamaged pages to map its advertised data capacity onto.

However, you don't seem to have looked at the logical structure of any  
partitions yet, so what does fsck tell you about that? If it reports that  
a partition's logical structure is damaged, can fsck repair it?


--  
Martin    | martin at
Gregorie  | gregorie dot org

Re: How to test MicroSD card?
real-not-anti-spam-address@apple-juice.co.uk (D.M. Procida) writes:
Quoted text here. Click to load it

That?s a somewhat unexpected response, since dd doesn?t know anything
about inodes.

Quoted text here. Click to load it

Per your other post, if it works on a Mac but not an RPi, you?ve not yet
distinguished the situation from a broken RPi or some kind of
compatibility issue (although I think the card being broken is most
likely).

https://github.com/ewxrjk/vbig can be used to do a _destructive_
write-read test of the whole medium. It can build for both Linux and
macOS.

--  
https://www.greenend.org.uk/rjk/

Re: How to test MicroSD card?
On 09/09/2018 10:54, D.M. Procida wrote:
Quoted text here. Click to load it

Perhaps you have access to a Windows environment?  I use this program:

   https://www.heise.de/download/product/h2testw-50539

which runs on Windows and tests the whole SD for read/write.  The  
program has an English language option.  I would first check for  
mechanical faults with a hand-lens visual inspection.

--  
Cheers,
David
We've slightly trimmed the long signature. Click to see the full one.
Re: How to test MicroSD card?
On Sun, 09 Sep 2018 10:54:16 +0100, D.M. Procida wrote:

Quoted text here. Click to load it

On the assumption that you have a USB SD-card reader and another known-
good bootable SD card:

- put the known-good card in the RPi's card reader and boot the system
- put the suspect card in the USB reader and plug it in but don't mount
  any partitions on the card
- now, from the command line:
  - start cfdisk to get the names of partitions on the suspect card,  
    probably /dev/sdb1 and /dev/sdb2 and stop cfdisk
    "man cfdisk" will tell you how to use it.
  - now run fsck against those partitions.
    "man fsck" tells you how to use fsck
  - both cfdisk and fsck must be run as root, so either become root
    to run them or prefix eash commands with 'sudo'

The suggestion to read the entire SD card with dd is a good one, but dd  
just checks that all partitions are readable, while fsck checks the  
logical filing system in a partition for errors that may have been caused  
by, e.g. powering off the RPI without first shutting it down with the  
"sudo stop" command.  


--  
Martin    | martin at
Gregorie  | gregorie dot org

Re: How to test MicroSD card?
On 09/09/2018 10:54, D.M. Procida wrote:
Quoted text here. Click to load it
I don't know about you but I'm getting old now with retirement looming.  
So I don't have the minutes left in my life to waste testing cards going  
suspect. It seems a better use of my time to go and order several decent  
cards from a reputable dealer and swap the suspect ones out and to keep  
some spare.

YMMV

Re: How to test MicroSD card?

Quoted text here. Click to load it

That's all very well, if you're confident that the source of the
problems have been the card, rather than the Raspberry Pi, the external
disk drive, the PSU...

Daniele  

Re: How to test MicroSD card?
On Sun, 09 Sep 2018 20:43:44 +0100

Quoted text here. Click to load it

    That'll be good right up until the day the problem is a dodgy
interface that destroys cards.

--  
Steve O'Hara-Smith                          |   Directable Mirror Arrays
C:\>WIN                                     | A better way to focus the sun
We've slightly trimmed the long signature. Click to see the full one.
Re: How to test MicroSD card?
On 10/09/2018 11:02, Ahem A Rivet's Shot wrote:
Quoted text here. Click to load it
You're right. But experience so far has shown all the cards I have that  
have failed have been through "wearing out" rather than anything else.  
I've had USB memory sticks fail for no good reason but not SD cards. As  
I said, YMMV.



Re: How to test MicroSD card?
Quoted text here. Click to load it

In case you mean you can test either in the Pi _or_ in another
machine, for a write-read test the following command pipeline
will generate a non-repeating pattern:

    yes '' | cat -n | tr -d ' \t' | pv -prb

The 'pv' part is optional if you don't want to see progress.

You can use 'dd' to write the pattern to the card, and then
'diff' with '-' as one argument to verify.

HTH

--  
Robert Riches
snipped-for-privacy@jacob21819.net
We've slightly trimmed the long signature. Click to see the full one.
Re: How to test MicroSD card?
On 11/09/18 04:27, Robert Riches wrote:
Quoted text here. Click to load it

Seems an amazingly complex way to generate a sequence of ascending  
numbers...


Quoted text here. Click to load it


--  
When plunder becomes a way of life for a group of men in a society, over  
the course of time they create for themselves a legal system that  
We've slightly trimmed the long signature. Click to see the full one.
Re: How to test MicroSD card?

Quoted text here. Click to load it

Use this:
http://oss.digirati.com.br/f3/

Bye Jack
--  
Yoda of Borg am I! Assimilated shall you be! Futile resistance is, hmm?

Re: How to test MicroSD card?
Quoted text here. Click to load it

Use the right tools for the job - the badblocks command for example.

In a Pi:

  sudo badblocks -c 1024 -s /dev/mmcblk0

(That took just over 5 miuntes to test an 8GB SD card in a 4 year old A+)

On other Linux systems, then the /dev/mmcblk0 may well be different. I've
no idea if Mac has the badblocks command but it would surprise me if
it didn't.

The badblocks command can also do a variety of write tests too, but I
do not recommend it on a live filesystem, and when you do put the SD
card into a different system, make sure it does not get auto-mounted,
or if it does, unmount it before running and write tests on it.

On the Pi there are other factors though - and you may well see a card
fail on the Pi and pass elsewhere - the common culprit in the Pi world
is the PSU and overclocking. Turn all overclocking off and make sure
you have a good reliable PSU (not a cheap charger)

-Gordon

Re: How to test MicroSD card?
On Tue, 11 Sep 2018 08:40:50 -0000 (UTC)

Quoted text here. Click to load it

    It's not available on MacOS or FreeBSD (where the MacOS CLI mostly
came from).

--  
Steve O'Hara-Smith                          |   Directable Mirror Arrays
C:\>WIN                                     | A better way to focus the sun
We've slightly trimmed the long signature. Click to see the full one.

Site Timeline