1 |
On Sunday 04 Sep 2016 17:48:14 Stroller wrote: |
2 |
> > On 3 Sep 2016, at 17:50, Mick <michaelkintzios@×××××.com> wrote: |
3 |
|
4 |
> > Yes, flash drives (unlike spinning drivers) are completely digital. In |
5 |
> > addition, wear levelling algorithms invariably kick in and bits and bytes |
6 |
> > are sprayed all over the pages/modules of the memory chips. So you could |
7 |
> > say they are fragmented by design. |
8 |
> |
9 |
> That would seem to dismiss the problem, "oh, they're fragmented by design, |
10 |
> thus it's unimportant". |
11 |
|
12 |
I'm far from an expert on NOR/NAND flash drives and therefore I didn't mean to |
13 |
sound dismissive. I was merely highlighting the fact that the memory |
14 |
controller on these cards interferes with whatever our OS is trying to write |
15 |
on them, as the card's chip controller implements various wear levelling |
16 |
algorithms. |
17 |
|
18 |
|
19 |
> My understanding is that defragmenting a flash device (although I think, |
20 |
> personally, I would only do this by deleting all the files on the drive, |
21 |
> and copying them back) can make for faster access. |
22 |
> |
23 |
> • http://www.lagom.nl/misc/flash_fragmentation.html |
24 |
> • |
25 |
> http://www.wizcode.com/articles/comments/flash_memory_fragmentation_myths_a |
26 |
> nd_facts/ |
27 |
> |
28 |
> Stroller. |
29 |
|
30 |
Some of these tests assume that flushing the OS cache *also* flushes the cache |
31 |
on the flash drive. This is not so, especially on more modern flush drives. |
32 |
I've been watching the behaviour of a Verbatim 32G USB stick I use more or |
33 |
less daily and I am convinced that running sync following a copy operation on |
34 |
my PC, in no way means the cache on the flash controller is also flushed. |
35 |
|
36 |
What these tests prove is that when the card is full it takes longer to write |
37 |
content on it, because blocks will have to be erased before they can be |
38 |
written on. The cluster size is quite important for this performance, as is |
39 |
the size of the file(s) being copied. |
40 |
|
41 |
What I am saying is that the write operation performance is determined by the |
42 |
cluster size, the file size, the flash drive's cache size and most importantly |
43 |
by the flash drive controller's wear levelling algorithms. There is no |
44 |
guarantee that data will be written contiguously, although they will be |
45 |
written in one-block-at-a-time. The blocks themselves almost certainly will |
46 |
not be contiguous on a used drive. Formatting it with unsuitable logical |
47 |
block sizes for its physical block size will almost certainly incur a write |
48 |
penalty (always depending on the size of the file being written). |
49 |
|
50 |
This is what I meant when I said USB flash drives are fragmented by design. |
51 |
-- |
52 |
Regards, |
53 |
Mick |