The Museum of HP Calculators

HP Forum Archive 16

[ Return to Index | Top of Index ]

SD card longevity
Message #1 Posted by Thomas Okken on 18 May 2006, 2:09 p.m.

It seems like the SD card I have been using for source code backups for the past 2 years has died... Files are disappearing or getting corrupted, etc.
When I tell Windows to check the disk and scan for bad sectors, it returns almost immediately and says everything's fine, but the problems reappear. (In fact the disk check is so fast that it couldn't possibly have checked all the sectors!)

I bought a couple of cheap USB memory sticks to use for the time being; I'll have to find out if it's really the SD card or the card reader that's broken.
What I'm wondering is: what are your experiences regarding SD card longevity? I expect that in a calculator, PDA, or even a camera, the cards get written to a lot less than the several megabytes a day of backups that I tend to save -- but how long do they last? (How long are they supposed to last?)

Thanks!

- Thomas

      
Re: SD card longevity
Message #2 Posted by Frank Boehm on 18 May 2006, 4:43 p.m.,
in response to message #1 by Thomas Okken

The memory chips used vary in their quality grade, so if you buy the cheapest stuff, don't expect to find a pot of gold at the end of the rainbow I'd highly suggest to use SanDisk (Kingston and a handful of other A-grade brands are fine as well though I'd suggest to stick to SanDisk); they are market/technology leader not without a reason.

The Flash-drives are - in my opinion - not really suitable as a HDD replacement, depending on the manufacturer, the number of write cycles is limited. Cheap stuff probably only hast 10k cycles until errors appear. 10k sounds a lot, but it isn't - the directory data is stored at a certain offset and each time you write (or erase) data, the directory is updated; so it's only 10000 files written or deleted until the drive fails. A-Grade chips (Samsung etc.) will last much longer, probably 10-100x as many write cycles.

There certainly is a reason for only offering 1 year of warranty on cheap stuff or lifetime on the expensive stuff.

            
Re: SD card longevity
Message #3 Posted by Thomas Okken on 18 May 2006, 6:54 p.m.,
in response to message #2 by Frank Boehm

Mine's a Kingston card -- I guess you're right about file copies pounding the directory entry on disk. I also suspect that the Linux driver is particularly nasty in this regard -- that would explain why copying large files or directory trees to the SD card takes so much longer under Linux than under WinXP.
Maybe I should dust off my Zip drive. I never lost so much as a bit with that thing. Bit too bulky for my pants pocket, though. ;-)

- Thomas

                  
Re: SD card longevity
Message #4 Posted by David Smith on 18 May 2006, 7:12 p.m.,
in response to message #3 by Thomas Okken

Part of the SD spec is something called "wear leveling". This attempts to spread writes out to previously unused physical sectors and maps them to their proper logical sector number. Properly implemented, you wont wear out a fixed directory sector. The spec and flash chips also supports bad block replacement.

                  
Re: SD card longevity
Message #5 Posted by Juan J on 18 May 2006, 8:53 p.m.,
in response to message #3 by Thomas Okken

Hello Thomas,

The CF card of my PDA began to have corrupt files after about one and a half year of intensive use. It was a SanDisk. At a point it wouldnot even be recognized by the PDA. I had it checked under Windows XP and got nothing: the card was oK. But then I used Windows 98's Scandisk. This time I did find bad files/sectors. Scandisk fixed the errors.

When I plugged the card back into the PDA, it was recognized. The card has worked like a charm since then.

I would also recommend SanDisk. And an older verion of ScanDisk and Defrag

                        
Re: SD card longevity
Message #6 Posted by James M. Prange (Michigan) on 18 May 2006, 9:07 p.m.,
in response to message #5 by Juan J

Both the Win98 version of ScanDisk and Norton Disk Doctor seem to be able do a thorough check of MMC/SD cards.

I have my doubts as to the usefulness of defragging the card though. My impression is that physical addresses are remapped to new logical addresses by the card itself every time that it's written to. Anyway, it's not as if a head has to be physically moved to a track or it has to wait for a particular sector to rotate under a head.

Regards,
James

                              
Re: SD card longevity
Message #7 Posted by James M. Prange (Michigan) on 19 May 2006, 2:41 a.m.,
in response to message #6 by James M. Prange (Michigan)

Now that I've thought about this a bit more, utilities such as MS ScanDisk and Norton Disk Doctor probably do a good check when doing a read-only test, but perhaps not so good for a read-write test. Such utilities presumably work a (logical) cluster (or perhaps sector) at a time, but it seems to me that with the card's wear-leveling remapping the blocks when it writes, the next logical cluster isn't necessarily the next physical cluster. What's more, when a cluster is marked as "bad" in the FATs, that would be the logical cluster, and which physical sectors that maps to would change because of the card's wear-leveling.

On the other hand, Juan reports that ScanDisk was able to fix his CF card. Perhaps CF cards don't do any wear-leveling? Or maybe attempting to write to (or read from) bad areas caused the card to "notice" the defects and map them out?

Regarding defragging, it seems to me that this typically writes a lot of clusters, and given that writing eventually "wears out" the flash memory, may actually do more harm than good.

Regards,
James

                  
Re: SD card longevity
Message #8 Posted by Arnaud Amiel on 19 May 2006, 3:24 a.m.,
in response to message #3 by Thomas Okken

I have ruined a couple of SD cards under Linux already. From then I never use them running Linux. I could recover them by formatting under windows but not under Linux.

Arnaud

                        
Re: SD card longevity
Message #9 Posted by Thomas Okken on 19 May 2006, 9:56 a.m.,
in response to message #8 by Arnaud Amiel

I tried timing read and write speed, this time using a 256 megabyte BTC USB memory stick. Under Linux, read speed was close to the rated maximum of 8 Mb/s, but write speed was only about 1/20 of the rated maximum of 5 Mb/s.
This makes me suspect that the Linux USB storage driver writes small logical blocks, instead of grouping them into a physical block before writing. This approach is probably fine on hard disks that use caching internally anyway, but SD cards perform the write operations immediately. If the Linux driver writes 512 byte blocks, while the card has 8192 byte blocks, that would cause 16 times as many writes as necessary to occur -- wearing the card out 16 times faster than expected.
The SanDisk "Wear Leveling" white paper actually warns about just this scenario. I guess the Linux USB storage drivers still need some work... Maybe I'll ask around on the Linux forums -- but in the meantime, I'll just try to avoid writing large files to SD cards under Linux, and try to do such tasks under Windows as much as possible.

- Thomas

                              
Re: SD card longevity
Message #10 Posted by James M. Prange (Michigan) on 19 May 2006, 4:21 p.m.,
in response to message #9 by Thomas Okken

Also see this SanDisk MultiMediaCard and Reduced-Size MultiMediaCard Product Manual. It's for MMC cards (which work fine in the 49g+) instead of SD cards, but I suppose that they'd be very similar. It covers 32MB through 256MB cards and was last revised in May 2004. How much other manufacturers' and newer cards would differ, I don't know.

Anyway, it says that "erase groups" are 32 sectors (16384 bytes) long, which suggests to me that to maximize life for these cards, the cluster size should be a multiple of 32 sectors.

If your card size can be formatted with the desired cluster size with either FAT16 or FAT32, then the only advantage that I see to FAT32 is that the root directory would have a variable number of clusters instead of a fixed number of sectors, and FAT16 has the advantage of smaller FATs.

To get a choice of file systems and cluster sizes, you may have to run the FORMAT command from the command line instead of the GUI, or use a utility other than the operating system's built-in FORMAT command.

Regards,
James

            
Re: SD card longevity
Message #11 Posted by Crawl on 18 May 2006, 7:25 p.m.,
in response to message #2 by Frank Boehm

I used a SanDisk card with my 49G+ and it gave me trouble. I could copy only between 1 and 4 files to it before everything would become corrupted. I traded it in for a Kingston, which has worked fine for me. So, I guess I'll have to be the naysayer that recommends against SanDisk.

In fact, now that I think back to that episode a little more, I looked up some reviews of that product (on Amazon and elsewhere), and I noticed a lot of people were complaining about incompatibilities with certain products.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall