Wizcode was founded in 2001. We now have more than 100,000 customers worldwide.

You are here: Wizcode » Articles & guides

Articles and guides

Welcome to Wizcode articles and guides section


2 votes

Flash Memory Fragmentation and PerformanceA quick Google search shows many "expert" suggestions that defragmentation of solid state drives should give no difference in performance while increasing the wear of flash cards and even possibly killing them.


Myth: Flash cards unlike hard drives do not have movable parts so defragmentation is useless.


On theory, since a flash drive does not have moving parts, its access time is independent on where the data is stored, which is why supposedly flash drives don't need defragmenting.


The fact is that flash memory is physically organized in blocks (or pages) of data, usually 128K or 256K large. Things get even worse from the fact that in order to change even one single byte, the entire page has to be first erased and then re-written with its contents again. In our example the time needed to change one byte of information is calculated the following way:


T = R + E + W


T is the total time, R is the time needed to read the entire flash page containing the byte we wish to change, E is the time required to erase the page and W is the time it takes for the data to be written back to the empty page. Not only we had to read 128KB in order to change a single byte but we also had to erase the entire block (which is very slow) and then write 128KB over again.


To complicate matters even further, it must be noted that there are additional layers between the flash card controller and the file system that cache pages being read and written to. The cache serves for improving performance. It is a simple trade-off between read/write performance and some RAM being used to cache the pages. It is most effective to read or write entire flash pages performance wise. When the operating system instructs the controller to read a particular sector on the card the cache normally retrieves the entire block and stores it internally. What this means is that information that is stored in a contiguous matter is more likely to be found in the cache than non-contiguous information.



Page 1 of 1 pages