Digital storage basics, Part 4: SSD explained

Do you know that there's a garbage collection inside your SSD? It's true! CNET editor Dong Ngo explains that and more. He also answers SSD-related questions.

Inside a standard SDD, the only component shared with a hard drive is the SATA interface.
Inside a standard SDD, the only component shared with a hard drive is the SATA interface. Dong Ngo/CNET

Editors' note: This post is Part 4 of an ongoing series that aims to explain digital storage, based on questions and inquiries from readers. For the other parts, check out the related stories.

Made to replace hard drives in many applications, SSDs have nothing in common with hard drives in terms of how they handle data. By popular demand, I am explaining in this post how they work in layman's terms. I'll also answer other SSD-related questions.

How SSDs work

To understand how an SSD works, let's start with two most important parts: the controller and the NAND flash memory. These two components, and few others, are put together on a printed circuit board (PCB), which is housed inside a casing to make up an SSD.

Controller: In an SSD, the controller is an embedded processor that bridges flash memory components to the host (such as a computer). The controller executes codes provided by the SSD's firmware (a mini operating system) to fulfill the data requests from the host. The controller decides how an SSD performs and what features it offers.

Popular functions and features decided by the controller include writing, reading, erasing, error checking, encryption, garbage collection, wear-leveling, RAISE, and over-provisioning. (Phrases in italics will be explained below.)

An SSD's controller is not to be confused with I/O controller interface, such as Serial ATA (SATA), which determines how a storage drive (both SSD and hard drive) is physically connected to a host. Most standard SSDs support the SATA controller interface that includes SATA (1.5Gbps), SATA 2 (3Gpbs), and SATA 3 (6Gbps). Unlike the controller interface, which you can see by looking at an SSD, the SSD controller is on the inside and invisible to users.

NAND flash memory
All modern standard SSDs use NAND flash memory, which is integrated circuits designed to store information. Enterprise SSDs generally use single-layer-cell (SLC) NAND, while consumer-grade SSDs use multiple-layer-cell NAND. The former is faster and lasts longer, but is also much more expensive than the latter.

Since these are not magnetic platters we're talking about, the act of writing to an SSD occurs when the controller programs the memory cells to store the information. In a nutshell, the memory cells store voltage and can be in either an on (1) or off (0) state, which allows them to store data in a binary form. In reality, writing to an SSD is very a complicated process. Reading from an SSD, however, is relatively simple, where the controller doesn't have to do a lot of work.

NAND flash memory cells come with a few interesting attributes. First, they can be programed for only a limited amount of time before they become unreliable. This is known as the write-endurance, or program erase (P/E) cycles. (For more on P/E cycles, check out this post.) To lessen this effect, a controller uses a technique called wear-leveling, which effectively makes sure that all the drive's memory chips are used, cell by cell, before the first cell can be written on again.

The second is that, unlike hard drives, NAND flash memory can't overwrite existing data. The old data must be erased before new data can be written to the same location.

The third attribute of flash memory is its inefficiency in erasing data. In an SSD, memory cells are grouped together into a page (typically 4kB each), and pages are then grouped together into a blocks (typically 512kB each, or 128 pages). You can write page by page, but can only erase block by block.

When a user deletes data stored on an SSD (and even chooses empty the recycle bin/trash), there's no erasing taking place. The operating system (such as Windows), using the TRIM command, simply marks the information that you want to erase as "stale" or "invalid", page by page. The actual erasing only happens when the user wants to write new data to the drive. So unless you're using a completely new SSD for the first time, there's no writing to the drive that happens without erasing taking place first. This results in the controller having to do something called garbage collection while writing information to an SSD.

Wear-leveling and garbage collection cause data to be re-written on SSD from one place to another, in a undesirable phenomenal called write amplification.

Despite their similar appearance, on the inside, an SSD has almost nothing in common with a hard drive.
Despite their similar outward appearance, on the inside, an SSD has almost nothing in common with a hard drive. Dong Ngo

Write amplification
Write amplification means the actual amount of physical information written on an SSD is more than the logical amount intended to be written. In other words, the SSD does more writing to its memory cells than the amount the host requires the controller to write. This negatively impacts the SSD's performance and P/E cycles.

Ironically, at the same time, write amplification is necessary to maximize an SSD's lifespan and optimize its performance. It's just the matter of balancing the negative effects and the benefits. Think of it as playing the game Tower of Hanoi, where you want to move the blocks in the least number of moves. As mentioned above, write amplification is caused mostly by garbage collection and wear-leveling.

Garbage collection
This is the main cause of write amplification. Before the controller can erase an entire block that contains some stale pages in preparation for writing new data to it, it (the controller) first has to move the good data on that block to another block.

You can think of garbage collection as managing an apartment building. When a rental unit becomes vacant, you first need to thoroughly clean up the entire apartment before moving a new renter in. If the outgoing party leaves items behind, say, a huge pile of books and clothes in the kitchen. You can't (for the sake of being efficient) clean the rest of the apartment's rooms, move new tenant in, start collecting rent, and worry about the kitchen later. In real life, you need to first move the stuff in the kitchen away, like to another (half) empty apartment, and clean up the entire place before letting anybody move in, even though the new tenant might not occupy every single room. This process creates more work for the building manager.

Again, garbage collection happens because NAND flash memory can't overwrite existing data -- it needs to first erase existing data before writing on the same cell -- and it can write data page by page but can only erase data block by block. And a block consists of many pages.

This is a technique that dynamically arranges data so that erasures and re-writes are distributed evenly across the SSD, effectively making sure no single block prematurely runs out of P/E cycles due to a high concentration of hot (frequently changed) data. Certain wear-leveling algorithms (called static wear-leveling), even periodically move static (unchanged) information (such as the operating system or programs) so that the SSD's low-usage blocks can be used for other, more frequently changed data. This helps enable all of the blocks on the SSD to run out of P/E cycles evenly, thereby prolonging the drive's life span.

Write amplification happens in all SSDs at different levels, and it requires free space, as a buffer, to work. This means you don't want to fill up the drive with data. Generally, an SSD works at its best with some 20 percent of its capacity as free space (not occupied by any data), unless the drive comes with over-provisioning.

Over-provisioning (aka OP)
OP basically means that some space on the SSD is reserved for the controller and is not available to the user. The controller can use this space for wear-leveling, garbage collection, or any other performance-optimizing features the drive might support.

Back to the apartment building analogy, OP is like having a dedicated storage room in the building to store stuff left behind by out-going renters, so that the manager won't need to use other rental units for that purpose.

Generally, the amount of space reserved for OP is anywhere between 7 and 28 percent of the drive's capacity. For this reason, OP-enabled SSDs come with somewhat non-traditional capacities, such as 120GB, 240GB, or 480GB, instead of the usual 128GB, 256GB, or 512GB. Some SSDs, such as the Samsung 840 Pro, allow end-users to manually manage OP. Other drives automatically use the free space for their OP feature.

By design, OP supposedly increases the SSD's performance (since the controller doesn't have to look for buffer space) but in real-life testing, I haven't found this to be clearly the case.

In summary, the weakness of SSDs, if we can call it a weakness, is only apparent when writing. That said, check out this post to find out how to best minimize the unnecessary writing to your SSD.

Other common SSD-related terms
TRIM: The TRIM command is designed to enable the operating system to notify the SSD's controller of pages that contains stale data (data that has been marked as deleted or invalid due to user deletion). This help the controller know not to relocate data stored on these pages during garbage collection, thereby lowering the number of writes to the flash memory. TRIM helps lower the write amplification and increases the performance of the drive.

RAISE: This is a feature available only in SanForce controllers. RAISE stands for "redundant array of independent silicon elements" and is designed improves the disk failure rates, as well as offer AES encryption. In reality, RAISE is more suitable for enterprise SSDs and has lost traction among consumer-grade SSDs.

IOPS: (Input/Output Operations Per Second) This is the unit for random access. In storage, random access is the ability to access (read/write) data at an arbitrary location, in a non-contiguous manner. Random access is generally associated with small data size and is the strength of SSDs.

Random access -- as well as its latency, which is very low on SSD -- decides how fast data can be made available to the host, which translates into boot time, application launch time, and overall performance. Hard drives generally have low random access, averaging somewhere between 75 to 250 IOPS. SSDs, however, can easily offer random access in the range of 50,000 IOPS to 100,000 IOPS and even more.


Q. My laptop's current hard drive is 1TB, can I clone it to an SSD of just 256GB?

A. Yes, as long as the amount of data on the hard drive is less than 256GB. Ideally, you want to reduce the hard drive's data to some 200GB or less before cloning since, as mentioned above, the SSD needs some breathing space for its write amplification. Note that some cloning applications don't allow for cloning from a larger-capacity drive to to a lower-capacity one. However, good cloning software, such as Acronis True Image, will get the job done.

Q. Relating to write-endurance, I have a Crucial M4 512GB SSD that I use as my main drive in my 2011 Macbook Pro, running the OS, apps, and related files. My secondary drive is the 500GB that originally came in the laptop which now holds my documents, libraries, pics, and vids. Do I need to worry about the SSD failing within the next five-plus years?

A. With the type of data you have and the assumption that you use the computer as an average user, even if you put everything on your SSD (but don't fill it up), it will not run out of P/E cycles in 20 years.

Q. I've heard that using file-sharing software, such as BitTorrent can damage your SSD. Is this true ?

A. It will not physically damage your drive but downloading is counted as writing and that helps use up the drive's P/E cycles, so watch your downloads!

Q. If I have a SATA 3Gbps port on my laptop, will I still see as big a performance boost from an SSD or will a Seagate hybrid drive be just as effective (or is this not an issue at all)?

A. Yes, you will see huge improvement if you're using a hard drive now. An hybrid drive will help, too, but not as much.

Q.When do you think the new gen Seagate Hybrid drives that debuted at CES will hit the shelves?

A. Very soon.

Q. Does it make any sense to use SSDs in network storage solutions, such as plugging one to a router via USB port?

A. No, not at all. At best, network storage solutions' performance cap at the speed of Gigabit Ethernet, which is 1,000Mbps or some 130MBps. It's overkill and wasteful to use SSDs in this case. The only time you want to use SSDs in a network solution is when you have a Web-server hosting a database (such as SQL). In this case, SSDs will help with the performance of your Web site, thanks to their high IOPs.

Q. Is there anything special you need to do when installing a third-party SSD on OS 10.8? I recently installed a Samsung 840 and some guides say you need to hack to enable TRIM, and some say it's fine without. If a hack is required, what do you recommend?

A. Yes, TRIM is very important to make an SSD work efficiently. Macs tends not to enable TRIM on non-stock SSDs, but in this case you can try the Trim Enabler tool to quickly enable it.

Q. I recently added an SSD to my PC that I built in 2008. The performance increase is amazing, but the SATA speed on my old motherboard is 3Gb/s. How much performance am I losing not having a motherboard with SATA 6Gb/s? And would it be worth it to put an SSD in a PS3?

A. Not as much as what you just gained from moving to an SSD. There's no need to get a new motherboard unless if you also want other features, such as the support for faster CPUs, faster RAM, or USB 3.0. And yes, by using an SSD with a PS3, your games will load much faster.

That's it for now. If you have questions, use the comment section below or feel free to send them my way via Twitter, Facebook, or Google Plus.

Featured Video
This content is rated TV-MA, and is for viewers 18 years or older. Are you of age?
Sorry, you are not old enough to view this content.

Wield Samsung's Note 5 S Pen like a boss

We show you the top tips and tricks to learn for getting the most out of the Note 5's all-new stylus.

by Jessica Dolcourt