Software to test flash storage

Is there a program that can interrogate a flash storage device to determine how many spare blocks remain?

I'm looking for a way to guesstimate when it's time to replace a microSD card or USB flash drive before it fails completely.

Thanks for reading,

bob prohaska

Reply to
bob prohaska
Loading thread data ...

Am 02.10.2018 um 03:44 schrieb bob prohaska:

Maybe this:

formatting link

Reply to
Helmut Harnisch

Do fsck or badblocks show anything useful?

I'd expect badblocks with the -n option to show something useful, but I've not used it on an SD card.

--
Martin    | martin at 
Gregorie  | gregorie dot org
Reply to
Martin Gregorie

Any S.M.A.R.T. diagnostic tool will tell you spare blocks remaining. The different parameters have fixed IDs, spare blocks remaining is ID=251 (0xFB) or sometimes 232 (0xE8), see

formatting link

Reply to
A. Dumas

SD cards and USB sticks usually don't have SMART protocol.

Bye Jack

Reply to
jack4747

On Tue, 2 Oct 2018 01:44:07 +0000 (UTC), bob prohaska declaimed the following:

It's probably meaningless -- since it depends upon how the internal controller was programmed. A device might be programmed with NO reserve blocks -- all blocks are considered usable from the beginning, whereas a similar device might have been programmed to reserve 5% of the total space for "bad block remapping".

Of course, since SD card wear-leveling algorithms mean data moves around every time one writes to a block, remapping takes place all the time... A card that reserved space could actually have blocks go bad sooner than one that didn't -- as the one that didn't is distributing the wear over all the blocks, rather than waiting for a block to fail before making use of any blocks in the reserve area.

What will kill a card is having a large proportion filled with relatively static data, and only a small amount of dynamic (log files, say) data -- as the dynamic data will keep recycling (erasing for reuse, then writing) the same small set of blocks over and over, wearing them out while the static data sits happily in blocks with a capability for high reuse. A card with "all" dynamic data will tend to reuse all the blocks through wear leveling.

--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
	wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
Reply to
Dennis Lee Bieber

I didn't realize the Pi supported badblocks. I'll give it a try.

My predicament was revealed by fsck: a fault was found, fsck asked permission to fix the fault and told me to run fsck again. The fault was still present. This went on till I gave up. If the block with the error is bad, and there are no spare blocks to replace it, this makes good if unhappy sense. I'm looking for some measuring tool that looks past the flash controller to independently ascertain the state of the storage media.

Thank you very much!

bob prohaska

Reply to
bob prohaska

Thank you! got a link to f3, which is already available to me.

bob prohaska

Reply to
bob prohaska

You don't get that in cheap SD card flash designed to temporarily store photos and to be obsolete before it reaches its wear life.

You need to use something that is designed to be primary computer storage, i.e. an SSD, as it's controller will not only be better at wear levelling, but also support all the health monitoring information.

---druck

Reply to
druck

I think this boils down to not using SD cards designed for capturing streaming data, i.e. for use in a video recorder (type codes 10,

30,60,90) for random access use, such as supporting a Linux filesystem.
--
Martin    | martin at 
Gregorie  | gregorie dot org
Reply to
Martin Gregorie

Probably you're right, but that's an expensive (and power-hungry) approach for a $35 computer that draws about three watts.

Thanks for writing!

bob prohaska

Reply to
bob prohaska

I've just ordered a Samsung Evo + 128GB microSD card, basically as an experiment. It'll be close to twice the capacity I need, maybe that'll help the working life. It claims a uhs3 speed rating, but I'll believe that when the package arrives.

The 16 GB card that failed actually lasted a rather long time; about six months of continual compiling, finally run up to over 90% capacity at the time it quit. In my environment that's probably an order of magnitude more writing than will happen in real use.

Is there any chance re-partitioning the failed device might wring a little more life out of it? Badblocks reports all bad blocks, but I was able to write a small file on the DOS partition, so it's not totally stuffed.

Thanks to everyone for reading and posting.

bob prohaska

Reply to
bob prohaska

On a sunny day (Thu, 4 Oct 2018 01:18:18 +0000 (UTC)) it happened bob prohaska wrote in :

Just an idea, if you use extra partitions on such a big card, then make sure you mount those with the 'noatime' option. That significally reduces write cycles to the card:

formatting link

Reply to
Jan Panteltje

also use zram instead of a swap partition. and put /var/log in a ram device (small, maybe 32MB) if you don't need persistent logs.

Bye Jack

Reply to
jack4747

When used for large file operations with a USB3 card reader, it will be very quick. As its a Samsung it will have OK performance with the Raspberry Pi, but no faster than any other class 10 card, and probably not as good as an older Samsung class 4 or 6.

The 128GB card will last longer a bit longer, but its not the best solution. A 128GB SSD would last for just about ever, and be vastly quicker for random access operations, particularly compiling.

The only reason not to get it would be lack of space for an external drive, in which case a Samsung USB3 bar would give almost the same performance as an SSD from the Pi, and much better life than an SD card.

Once its found to be unreliable, bin it. Anything else is just inviting grief!

---druck

Reply to
druck

Small capacity SSDs (SD card sized) are quite cheap, you can even pick up used ones on ebay which have plenty of life left in them. As for power, SSDs don't get as hot as some SD cards or USB sticks, the smaller ones can get too hot to touch when used in a Pi.

---druck

Reply to
druck

Haven't seen sdcard-sized ssd's, yet, but haven't looked either. I do know there's this, supposedly it's ssd-technique in a usb stick, 128 GB version of which can be had here for ?60 inc. tax:

formatting link

Reply to
A. Dumas

AS> Yes. One might consider an SSD in a USB enclosure to have that AS> information. I recently built one for myself, just as a fast portable AS> media. Enclosure from ebay and drive (M.2 2240 size) from a local AS> store.

AS> Price was about the same as a fast USB stick (128 GB) but you get AS> support for TRIM at least. I haven't checked SMART, support really AS> depends on whether the USB controller passes through those commands AS> through to the driver or not.

AS> Physical size is somewhat wider and longer than your typical USB AS> stick. The width causes trouble with tightly grouped USB ports. There AS> might be better enclosures than what I got.

A USB 2.0 cable with USB A connector on one end and the other end has a USB B connector may be helpful.

Getting a B-I-G USB enclosure (or Thumbdrive) plugged in to something like a USB Hub where the slots are close together can be very trying...

Instead of buying Thumbdrives, I've been buying Micro SD cards.

I slip them in a SD card Adapter and insert that into a SD card to USB 2 Adapter.

And Yes!, I use the USB A to B cable when I need to use it.

The SD card Adapter has a Lock lever whereas Thumbdrives don't have one.

I 'think' that that lever keeps the (Micro) SD Card from getting anything written to it unless I move the lever to allow something to be written to that card.

I feel safer having the lever in the Lock position when I use it in My computer OR with a friends computer.

I Scan the card with Avast, Malwarebytes and SuperAntiSpyware Before I go to use it in a friends PC, and Scan it again After I return home.

I don't want the card to put MALWARE on a PC, especially not on mine.

Practicing Safe Computing makes one PARANOID doesn't it?

... !uoy knaht ,enif tsuj gniod m'I

Reply to
Ed Vance

The Samsung Portable SSD T5, 250 GB version for ?90 is definitely a better price per GB and probably a better product if you don't care about the stick form factor. For one it's actually usb 3.1 gen2, not 3.1 gen1 which is actually just 3.0; although of course one or the other won't matter with the RPi's usb 2.0 ports. More importantly, and it's maddening that they don't give technical details, I trust the controller/provisioning of an actual ssd in external housing more than a "solid state" usb stick.

But yeah, at ?90 it does get a bit mad for a $35 computer. What I did for my home server which has to be more reliable than an sd card, is buy a 2.5" portable spinning disk of 1 TB for, idk, ?45? Speeds are fine over usb 2.0 and as a server on wifi. Haven't used it on the desktop, though; maybe it would need more snap there.

Reply to
A. Dumas

Any idea what sort of power consumption can be expected for a modern small mechanical hard drive? The only one I have is old and probably uses twice the power of the Pi when idling. For 24/7 operation that does add up. The extra wallwart and wires don't help.

Thanks for writing!

bob prohaska

Reply to
bob prohaska

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.