Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

As I understand it wear-leveling on USB-sticks / Flash-drives will:

  • help to make the last longer. (reduce the "wear-out", that a physical flash cell can only be writen to XX times)
  • can only really work if there is unused flash-memory cells to switch to. (The more filled the USB-stick is, the less alternative cells to level the wear out are there)

In worst case at one point of time I have used up all and every memory of the USB-Stick. Then it is less likely that some wear leveling can happen still. Can/(How would) I revert this state?

I mean in terms of USB-sticks what is empty

0000 0000 0000 0000 (zero fill) seems to me just to be as valid a data as
1111 1111 1111 1111 or 1010 1110 0011 1111 or any other bit-pattern.

The firmware of the Usb-stick needs somehow to know what is considered an "unused" Flash-cell, so that it can use it for wear leveling again. But after I have one-time eventually filled the whole USB Stick I have trouble to see how the firmware will be able to determine what data can be "overwriten" since it is not containing data?

So my question is: Can zero-filling be a way to reset the wear-leveling a USB-Stick

Allthough I fear that maybe this will often depend on the implementation ("firmware" and "manufacturer") I still think there could be a logic to this approach to assume that "zero-filling" can be reseting the usb-stick on certain -better designed- Usb-Sticks.

The logic I imagine would be, that the firmware's wear leveling would recogize that an entire block (i.e. 512bytes or 2kbytes) would be set to only zeros.

Block before: 1101 1011 1000 0010 ... 0001 0011
Block after: 0000 0000 0000 0000 ... 0000 0000

When I read from this Block I would like to receive of course this information:
Block after: 0000 0000 0000 0000 ... 0000 0000 But this information could be generated on the fly by storing that Block XYZ= empty in a certain flash cell only available to the firmware.

If this would be the case the pool when "reset" (by zero-filling) would be enabled to serve for other purposes, since the information is stored in the BLOCK XYZ=empty firmware memory part of the stick.

I have read that there should be some USB-sticks that have such a firmware and hence can be reset? Can this be true? I would like to know by the question a "tendency" maybe backed up with information from prominent manufacturer. Maybe there exists even a list that lists USB-sticks which can be reset in this way. So that the answer could contain a link to such a list.

Also I assume that there is not "a new firmware" designed by each USB-Stick produced and maybe there is a prominent(often used) USB-firmware that does such a wear leveling. So then the quesiton could be answered with respect to that firmware.

At best there some smart person could come up with a way to answer the question in that form that it contains some instructions that enabled us users (of super-user) to "find out" if this wear leveling is enable or not.

some background to my question

USB-sticks / Flash-drives are a nice things sure. But the problem is that the way they store the data wears out, which means after only XX Writes to a data cell !BINGO! your Stick is dead!

A way to aliviate the problem (that Flash memory cells can only be writen to quite small number of times) is "wear leveling". Which will care that -if possible- the data is not always writen to the same flash memory cells.

The way that works is that instead of writing the data always to the same physical cells the data (when changed) is writen to some other new physical cells. This reduces the "stress" because in best case this will go on like this.

To help understand some basic of wear leveling I included this concept below, which shows how the information of "hello","salut","hola" and "hi" is subsequently stored in a logical data cell named data, which is actually writen to a different physical flash memory each time (hence a small "concept" of wear leveling).


state 1:
[CELL1: e-m-p-t-y] [CELL2:e-m-p-t-y] [CELL3: e-m-p-t-y]


=> write data "hello"


state 2:
[CELL1: hello]     [CELL2:e-m-p-t-y] [CELL3: e-m-p-t-y]
 data=CELL1

=> update data to "salut"


state 3:
[CELL1: hello]     [CELL2: salut]    [CELL3: e-m-p-t-y]
 data=CELL2

=> update data to "hola"

state 4:
[CELL1: hello]     [CELL2: salut]    [CELL3: hola]
 data=CELL3

=> update data to "hi"

state5
[CELL1: hi]     [CELL2: salut]    [CELL3: hola]
 data=CELL1 


Observe how after writing 4 times data each cell in average was only writen 1.33 times. Also observe that the information which cell contains the "logical data" is to be also stored and updated (which requires the firmware to do this accounting -using some reserved memory for this also)

share|improve this question

2 Answers

USB storage is neither mechanical (like the early beads on a grid) nor magnetic (like on tape) nor optical (like CDs) but electrical. Consider each location as a small battery cell that over time (a long time) discharges. All writing causes degradation. Zero filling will only make matters worse. The chip itself either has a controller that uses wear levelling or it does not - a user can't change this. In simple terms, wear levelling just ensures that different parts of the USB get a fair share of the storage requirement burden.

share|improve this answer
thank you. I cannot understand why you explain to me that it is not mechanical/magnetic? (My question surely was not as dumb as to provoke I would not know this already). The question is actually about the specifics of the "wear leveling" and how a zero-fill (assuming a certain firmware) would indeed be able to reset the device. I just cannot accept that once writen to all blocks a stupid "wear-leveling" would never recover. Hence I think there must be something like a "TRIM" or reset (via zero-fill) for "good Usb-sticks" – humanityANDpeace Jan 13 at 12:14
@humanityANDpeace Whether 1 or 0 is like Yes or No answers to 20 Questions – they use up ‘lives’ equally. Re taking you for an idiot, please note that answers here are intended to be of potential use to many more that simply the one who asked the question. But life can be extended by ensuring the USB device is powered up often enough. – pnuts Jan 13 at 12:26
thank you for explaining the part (that questions are intented for a broader audience) and I am sorry I took it wrong. Indeed I really enjoy that there has been at least an attempt to answer the question. Is this "power USB on often" related to the "height increases flash-cell lifetime" issue, or how did you mean it? thanks – humanityANDpeace Jan 13 at 18:02
@humanityANDpeace Apologies for delay. I am not sure what you mean by "height increases flash-cell lifetime" and feel in any case that does not really address the OP (nor indeed did my comment about powered up often enough - but that makes the digression worse). Maybe start again with a new posting? – pnuts Mar 13 at 18:02

Then it is less likely that some wear leveling can happen still. Can/(How would) I revert this state?

You could backup/copy all the files, then delete all files or "reformat" the "drive", and then restore/rewrite the files. This would expose most (or as many possible) blocks as "available" and hence rewrite-able, based on a least-recently-used alogorithm.

Can zero-filling be a way to reset the wear-leveling a USB-Stick

No, you would be simply reducing the life of those blocks unnecessarily.

Note that more sophisticated wear-leveling schemes are not affected by the amount of used versus unused blocks. In such schemes even "stagnant" files will eventually be relocated periodically to another part of the flash memory to expose low-usage areas.

In general, any effort on your part to "help" wear-leveling will be counterproductive.

share|improve this answer
"You could ..." in the context "In worst case at one point of time I have used up all and every memory of the USB-Stick" doesn't look quite right to me as it stands. Would you clarify? I took it that OP was considering the "full" scenario - are you interpreting the OP as having subsequently deleted some content? – pnuts Mar 13 at 17:47
1  
Yes. If the flash drive is full, then there's no need any more to worry about wear; by the definition of "full", there's no free space to write a new file. Worrying about flash wear implies that there is free space that could be repeatedly written. I'm also assuming that a filesystem for a flash device will allocate a new sector even when "rewriting" or "overwriting" an existing sector in a file. So if the flash drive was "full", you shouldn't be able to rewrite records in an existing file. – sawdust Mar 14 at 9:07
TQ - very logical! (:$ I had, wrongly, focussed on the 'last longer' part only.) – pnuts Mar 14 at 9:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.