|
Checking the quality of an SD drive |
Chris Katko
Member #1,881
January 2002
|
Linux guys... know a good way to scan an SD card for bad sectors? AFAIK, blocks are arbitrarily moved around for wear leveling on flash drives and SSD drives (which are more-or-less just flash + maybe some DRAM cache). So if you nuke a block to zeros, and read it back to check it, for all you know, you're reading a different block each time. I could also try Windows (if such tools work correctly, such as the internal windows format tool) but I have had ZERO LUCK with SD card readers. I've bought at least 5 throughout the years and every one craps out, seizes up, burns up (!) or just plain doesn't work. Meanwhile, every LAPTOP SD card reader I've had has been exemplary and works great. Well, I've got a Linux laptop, and a Windows PC with a crap SD card reader. So those are my choices. If I HAD to, I could dig up my old work laptop but it takes a day-and-a-half to boot up. -----sig: |
Eric Johnson
Member #14,841
January 2013
|
Well, it's like you said, blocks are moved around arbitrarily, so there's no real way to accurately check for "bad sectors". As I understand it, if you do encounter bad sectors on an SD card, it's likely the whole thing is dead, so nothing can be done there. Also, an SD card is more likely to fail when writing than when reading... That being said, maybe you could try to fill the card to (or near) full capacity, and then compare its contents to a controlled directory of the same contents. For example, if your card is 2GB, then get ~2GB of files together and place them in a directory. Then, get the md5 or sha1 hash of that directory and write it down. Next, format the card and then fill it with the ~2GB of files from the directory. Check the contents of the SD card with md5 or sha1 hash and compare it to the directory's hash. I'm just spitballin' here, but my thinking would be that the hashes should be the same if the files were written correctly; if not, then the card is going bad somewhere. Dunno for sure though.
|
Chris Katko
Member #1,881
January 2002
|
I ended up using DD to making a file just under the filesystem's size, filling it with /dev/random. It didn't have any file system / hardware errors so that should be pretty good unless it's a silent error. Maybe I'll make a small bash script that actually dumps in chunks of data and verifies them until it fills the medium, and then deletes them back when done. I could do that in an evening. I've got other SD cards to check yet but the two I had were somewhat obviously "good" and "bad." The good one hadn't had problems ever, and the bad one has been dead on every controller I try to load it on and it never even enumerates to a drive. ... Come to think of it, I should confirm it's not showing up (but not mounting) in dmesg, but I'm 99% sure it's a completely dead card. [edit] Any idea how to mount a card that won't mount? Possibly a dead/broken/raw file system? It won't show up in blkid or fdisk -l. But dmesg shows: Quote:
[14773.156881] usb 2-7: new high-speed USB device number 18 using xhci_hcd
-----sig: |
Eric Johnson
Member #14,841
January 2013
|
I'm not sure you can mount it if it's dead. Strange that dmesg shows it as a USB device. Does it show up in lsusb? Also, does anything show up in /media when you insert the card?
|
Johan Halmén
Member #1,550
September 2001
|
Someone told me that old Windows software, which searched for bad sectors on hard disks or floppys and disabled them, could work on SD cards, too. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest. |
|