Scott said:
I'm not entirely following this (bit too technical) but am I correct
in understanding that if TRIM is enabled the foregoing process is not
required?
Going through the TRIM article on Wikipedia, TRIM seems to make
the drive aware of more parts of the drive being reusable. If
the drive and partition are not "full", then the drive can add
the unused bits to its unused pool. And then, find more opportunities
for garbage collection and rearranging the data. Take my Windows 7 partition,
with its 26GB or so of data. If that was sitting on an 80GB SSD, then
the drive would then know about another (80GB - 26GB) being free.
Whereas, on a well used drive, without TRIM, the entire 80GB could
be seemingly occupied with data (as far as the drive is concerned),
meaning, when the drive does GC, the only spares it has, are the
hidden spares from when the drive was commissioned. (An 80GB drive, might
have 10 or 15GB reserved, out of reach of the user. Each drive has some
level of unused blocks, which will be unused even when the drive
is full as far as the user is aware.)
Keep in mind as well, that there is one level of indirection involved
in flash drives. (That's done, so the drive can do wear leveling.)
You as the user, think you've stored something in
Sector 0. The SSD keeps a mapping table, and knows sector 0 is stored
at located 123456 at the moment. If you rewrite sector 0 as the user,
the drive may allocate another block 342546 and store sector 0 there.
Because of the indirection and mapping notion, it's possible for the
storage state of the SSD internally, to bear no resemblance to how
you think the data is stored at the file system level. Garbage
collection makes no sense, unless you're aware there is indirection
present, and only the SSD knows the mapping between sector number,
and where in the flash, the data is actually stored. If that mapping
is ever corrupted, you're screwed.
Garbage collection then, is tidying up the internal organization, so
that high-speed writing is possible when the user asks for it. If the
drive didn't GC, perhaps write speed would be pathetically slow when
you needed it.
I don't get the impression, that TRIM solves garbage collection. Garbage
collection still has to run. And should be running, any time the disk
is idle. Exactly what the definition of idle is, I haven't a clue. In
"hardware land", this could be any time there is nothing sitting in a
command queue. Meaning, the drive could work on GC the instant it
finishes the last command. If a command comes in, it may require the
GC to "replan" the last operation it was going to do, in case the
system state changed such as to invalidate the move it was planning to do.
Maybe all it would take, is a "blip" to the disk every two seconds,
to prevent it from making any forward progress on GC (because it's forced
to replan things, and that may take some time).
Without any other tools here to work on it, if I wanted to intuit
what a drive was doing, I'd monitor DC current flow into the SSD
as a function of time. That might help me to determine, when the drive
has gone idle, and when it is busy. Some drives (SandForce), the
available data suggests a big current flow difference between being
active and being idle. Some other brands, the specs seem to indicate
the current flow levels are ridiculously (unbelievably) low. So perhaps
I could definitely tell you a SandForce was doing something in the background,
whereas on a Samsung, maybe the numbers would be too small to reliably
use. If the drive had an "internal activity LED", we wouldn't need
to come up with ideas like this. But otherwise, I don't know of a way
to determine what a drive is doing.
Even your hard drive, is busy behind the scenes. Only, in the case
of a hard drive, it's "not doing anything evil". A hard drive, runs
internal SMART routines when it's not busy, intended to test that
certain things still work on the drive. On at least one SCSI drive,
noted in the past, you can tell there is internal activity, because
the drive used to make an audible "buzz" sound of head movement,
every 71 seconds. It was so loud, that it drove several users
right round the bend. That's how you find out a hard drive,
has its own processor, and it can be doing things internally
when you think it is otherwise idle. Since the drive was intended
for servers, the disk manufacturer didn't consider the noise
level to be a problem. But people with that drive in a bedroom,
it didn't stay powered there for long.
Paul