how to inspect and test SD-family "media cards" -- SD, mSD, uSD
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
how to inspect and test SD-family "media cards" -- SD, mSD, uSD
I have a number of SD-family media cards that I use with my DSLR and Digital Audio Recorder. I believe there is a limit to the number of write-erase cycles these devices tolerate. Is there some way to inspect a device and learn how deep it is into its reasonable life?
i don't remember seeing a kernel option for that specifically, but there SD support has to be in the kernel to read/write them
i do remember seeing linux hack talks about "unlocking" the card. the cards have "extra memory" that gets consumed as the card "stops responding" (the chip inside the SD handles consuming it to appear as if everything is "normal"). apparently if one wants a "write once/few, read many" SD they can unlock the card for something like 2x the storage. i doubt it's supported on all brands: but it's been done by some on some brands.
if you unlocked the card, that would seem to be the way to know what ammount is accessible. you'd then have to run fschk(1) with read and or write (noting writes are what your trying to avoid due to limitations) to know what memory is not in "bad blocks" and what memory is still writeable.
if the SD is NOT UNLOCKED, then i you'd have to have some userland tool that knew the chipset well enough to hack in and read inner tables of the SD that do the "automatic masking", and i doubt you'll find that
Last edited by X-LFS-2010; 06-25-2018 at 02:30 PM.
Cards die, simple fact of life. Carry spares, and make regular backups.
KISS.
Back around 2000 I got a 340 MB (yes, megabyte) microdrive - real spinning disk in a CF form-factor. Gotta be more robust than crappy CF cards methinks. It died on my first overseas trip with it - I suspect it was the humidity as well as the bouncing around. Didn't have a backup, and could never recover all the photos.
Lesson well learnt - the microdrive remains in my office as a reminder.
SD media behave like "disk drives" in many, but not all, ways. lshw tells me about the SD controller, but not the media currently in place. stat /dev/mmcblk0 (or any of the partitions) is also silent about the in-place media.
I tried smartctl several different ways. It does not seem that SD-media support smart. It could also mean that my specific controller does not, but media might. (The media is a vfat/fat32/exfat as built so it is more likely a media issue.)
Code:
sudo smartctl --device=ata --all --tolerance=verypermissive /dev/mmcblk0smartctl 6.5 2016-01-24 r4214 [x86_64-
**********
linux-4.4.0-116-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org
Read Device Identity failed: Invalid argument
=== START OF INFORMATION SECTION ===
Device Model: [No Information Found]
Serial Number: [No Information Found]
Firmware Version: [No Information Found]
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: [No Information Found]
Local Time is: Tue Jun 26 11:46:28 2018 CDT
SMART support is: Ambiguous - ATA IDENTIFY DEVICE words 82-83 don't show if SMART supported.
SMART support is: Ambiguous - ATA IDENTIFY DEVICE words 85-87 don't show if SMART is enabled.
Checking to be sure by trying SMART RETURN STATUS command.
SMART support is: Unknown - Try option -s with argument 'on' to enable it.
Read SMART Data failed: Invalid argument
=== START OF READ SMART DATA SECTION ===
Error SMART Status command failed: Invalid argument
SMART Status command failed: Invalid argument
SMART overall-health self-assessment test result: UNKNOWN!
SMART Status, Attributes and Thresholds cannot be read.
Read SMART Error Log failed: Invalid argument
Read SMART Self-test Log failed: Invalid argument
Selective Self-tests/Logging not supported
prompt $
I also tried:
Code:
prompt$ sudo smartctl --device=scsi --all --tolerance=verypermissive /dev/mmcblk0
**********
smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.4.0-116-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org
Standard Inquiry (36 bytes) failed [Invalid argument]
Retrying with a 64 byte Standard Inquiry
Standard Inquiry (64 bytes) failed [Invalid argument]
=== START OF READ SMART DATA SECTION ===
Request Sense failed, [Invalid argument]
Error Counter logging not supported
Device does not support Self Test logging
prompt$
and I tried:
Code:
prompt$ sudo smartctl --device=sat --all --tolerance=verypermissive /dev/mmcblk0
**********
smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.4.0-116-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org
Read Device Identity failed: Invalid argument
=== START OF INFORMATION SECTION ===
Device Model: [No Information Found]
Serial Number: [No Information Found]
Firmware Version: [No Information Found]
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: [No Information Found]
Local Time is: Tue Jun 26 11:51:26 2018 CDT
SMART support is: Ambiguous - ATA IDENTIFY DEVICE words 82-83 don't show if SMART supported.
SMART support is: Ambiguous - ATA IDENTIFY DEVICE words 85-87 don't show if SMART is enabled.
Checking to be sure by trying SMART RETURN STATUS command.
SMART support is: Unknown - Try option -s with argument 'on' to enable it.
Read SMART Data failed: Invalid argument
=== START OF READ SMART DATA SECTION ===
SMART Status command failed: Invalid argument
SMART overall-health self-assessment test result: UNKNOWN!
SMART Status, Attributes and Thresholds cannot be read.
Read SMART Error Log failed: Invalid argument
Read SMART Self-test Log failed: Invalid argument
Selective Self-tests/Logging not supported
prompt$
Last edited by SaintDanBert; 06-26-2018 at 11:56 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.