All about SSDs: Difference between revisions

mNo edit summary
Line 54: Line 54:
The way in which an SSD works is radically different from a hard disk is several respects:
The way in which an SSD works is radically different from a hard disk is several respects:
* An SSD stores data as electrostatic charges on a silicon chip whereas a hard disk stores it as patterns of magnetism in a spinning magnetic disk.
* An SSD stores data as electrostatic charges on a silicon chip whereas a hard disk stores it as patterns of magnetism in a spinning magnetic disk.
* When you write data to a hard disk it simply overwrites any previous data in the same location on the disk. But you can't write zeros to an SSD, you can only write ones. (All  data consists of ones and zeros). Hence the area you want to write to has to be erased (set to all zeros) before you start.
* When you write data to a hard disk it simply overwrites any previous data in the same location on the disk by remagnetising it with the new data. But you can't write zeros to an SSD, you can only write ones. (All  data consists of ones and zeros). Hence the area you want to write to has to be erased (set to all zeros) before you start.
* You can't erase a little bit of an SSD here and a little bit there. It only allows you to erase quite a large block (measured in [[Glossary:MB|megabytes]]) of memory at a time. (This is simply one of the trade-offs which has allowed vast storage capacities to be achieved.)
* On a hard disk, reading and writing take the same length of time (unless it's reading a marginal block requiring retries and error correction). Reading an SSD is really fast, but writing is considerably slower and erasing is slower still.
* On a hard disk, reading and writing take the same length of time (unless it's reading a marginal block requiring retries and error correction). Reading an SSD is really fast, but writing is considerably slower and erasing is slower still.
* You can't erase a little bit of an SSD here and a little bit there. It only allows you to erase quite a large block (measured in [[Glossary:MB|megabytes]]) of memory at a time. (This is simply one of the trade-offs which has allowed fast storage capacities to be achieved.)
* You can write to a hard disk as many times as you like without wearing out the magnetic surface, but writing to an SSD causes wear. An SSD will therefore choose for itself where to put your data and remember where that was, so as to spread out the wear. This is known as wear-levelling.
* You can write to a hard disk as many times as you like without wearing out the magnetic surface, but writing to an SSD causes wear. An SSD will therefore choose for itself where to put your data and remember where that was, so as to spread out the wear. This is known as wear-levelling.


A consequence of all this is that as you create, edit and delete files, more and more blocks of storage will contain some data which is still current and quite a lot which is not (deleted and old versions of files, known as "stale" data). Eventually you would end up with no empty blocks to write new data to even though the SSD might only be half full of current data. To deal with this problem the operating system (Windows, MacOS or Linux) tells the SSD which data is no longer needed through a process known as TRIM. As a background task, the SSD then tries to consolidate the current data into fewer blocks, freeing up blocks which can be erased and re-used. This process is known as garbage collection.
A consequence of all this is that as you create, edit and delete files, more and more blocks of storage will contain some data which is still current and quite a lot which is not (deleted and old versions of files, known as "stale" data). Eventually you would end up with no empty blocks to write new data to even though the SSD might only be half full of current data. To deal with this problem the operating system (Windows, MacOS or Linux) tells the SSD which data is no longer needed through a process known as TRIM. As a background task, the SSD then tries to consolidate the current data into fewer blocks, freeing up blocks which can be erased and made available for reuse. This process is known as garbage collection.


All this represents quite a lot of work for an SSD, keeping track of where it's put all your data and which bits of it are still needed and which aren't. So if anything goes wrong it can go very badly wrong, leaving the SSD totally confused and no longer able to operate. This might happen, for example, if power is suddenly lost or a power surge occurs while the SSD was in the middle of doing garbage collection. SSDs (certainly the better ones) are designed to cope with such an eventuality but it does occasionally happen. By contrast, when a hard disk fails it often does so more gracefully, giving increasingly frequent read errors and so allowing you more chance to recover your data. A hard disk may therefore be more suitable than an SSD for backup.
All this represents quite a lot of work for an SSD, keeping track of where it's put all your data and which bits of it are still needed and which aren't. So if anything goes wrong it can go very badly wrong, leaving the SSD totally confused and no longer able to operate. This might happen, for example, if power is suddenly lost or a power surge occurs while the SSD was in the middle of doing garbage collection. SSDs (certainly the better ones) are designed to cope with such an eventuality but it does occasionally happen. By contrast, when a hard disk fails it often does so more gracefully, giving increasingly frequent read errors and so allowing you more chance to recover your data. A hard disk may therefore be more suitable than an SSD for backup.

Revision as of 15:01, 9 December 2019

Solid State Disks (SSDs) come in a variety of shapes and sizes and they work in a totally different way to a conventional hard disk. Whether you're replacing a failed SSD or upgrading from a hard disk, an understanding of these things will help you achieve a successful outcome.

Summary

This page is in two main sections: firstly we discuss the different shapes, sizes and types of SSD, and then we explain how they work and hence how they need to be treated differently from a hard disk.

But first let's get one thing straight: a Solid State Disk is no more solid than a hard disk, and it isn't even disk-shaped! (The only liquid state computer memory that has ever been invented was the mercury delay line, and those went out of fashion in the 1950's.) An SSD would be better called semiconductor, electrostatic, non-magnetic or non-rotating memory, but we seem to be stuck with the name we've got.

Safety

Warning03.png
Always back up data before starting if you possibly can.

Shapes and Sizes

A 2.5" SATA SSD.

The commonest and perhaps the most familiar SSDs are direct replacements for hard drives, but modern ultra-thin laptops often use different sorts, and here it can start to get confusing.

2.5" SATA

These are identical in size and shape and in the type of connector to 2.5" hard drives, but they are lighter and usually only 7mm thick, whereas 2.5" hard drives can be up to 15mm for the higher capacities. Therefore you may need to add some kind of packing if upgrading a 2.5" hard drive to an SSD in order to retain it in its bay.

1.8" MicroSATA or μSATA

These are similar to 2.5" SATA drives but in a 1.8" form factor and with a smaller version of the SATA connector. They are sometimes used in smaller devices such as netbooks.

MiniSATA or mSATA

A size comparison of two SSDs: mSATA (left) and M.2 B+M keyed (right).

Considerably smaller still are mSATA SSDs, simply consisting of a small circuit board about the size of a business card. They have a gold plated edge connector fitting into a socket similar to a RAM socket, and two holes for fixing screws at the corners of the opposite edge.

The physical dimentions and connector are identical to a PCI Express Mini Card as used for older internal laptop WiFi adapters but the connections are different and so they are not interchangeable.

M.2

M.2 SSDs can come in a variety of sizes denoted by a code indicating the width and length, e.g. 2280 indicates a width of 22mm (much the commonest) and a length of 80mm (including the edge connector).

Confusingly, there are two different flavours distinguished by a keying notch in the edge connector. This can be in one (or both) of two different positions, known as B-key and M-key. The terminology only adds to the confusion, and if that weren't enough, other devices such as newer laptop WiFi cards also come as M.2 devices.

M.2 has provision through different pins on the edge connector for several different types of interface, in particuar, SATA (used for disks), PCIe (PCI Express: faster than SATA and used for disks, but not just disks), SMBus (used for managing peripherals) and USB. However, different M.2 cards support different combinations of these interfaces, and an M.2 socket may not be wired up for all of them. So for example, if you fitted an M.2 SSD to an M.2 WiFi adapter slot intended to accept a USB device it might work if the SSD supports USB in addition to SATA or PCIe, but an M.2 SSD slot, which might be wired only for SATA or PCIe devices, is less likely to accept a WiFi adapter which requires to be driven as a USB device.

NGFF is another name for M.2.

Beware: the B- and M-key positions are almost symetrically placed, which means that you may be able to force a B-key card upside down into an M-key connector (or vice versa) if you mistakenly purchased the wrong sort. Don't do it! There is a severe risk that you will kill both the M.2 device and the circuitry on the motherboard behind the M.2 slot, as well as physically damaging the slot itself.

B-key

B-key (left) and M-key(right) sockets (above) and edge connectors (below).

B-key cards (sometimes known as Socket 2) offer SATA and SMBus and may support USB. They are sometimes descibed as SATA rather than B-key. Optionally, they may also have the M-key and offer two PCIe channels (described in specifications as PCIe x2) for wider compatibility.

More recent laptop WiFi cards are frequently B-key devices, communicating with the motherboard using the USB connection.

M-key

M-key cards (sometimes known as socket 4) offer four PCIe channels (described in specifications as PCIe x4) and SMBus. They can transfer data twice as fast as PCIe x2 devices and may be descibed as NVMe or PCIe rather than M-key. They may also offer SATA but do not support USB.

NGSFF or NF1

This is yet another type of SSD, slightly larger than M.2 but still using an M-key connector. However, they are not compatible and are mainly used in servers. Such a server might have a tray containing a number of such cards.

Under the Bonnet

Unlike a hard disk, an SSD contains no moving parts or delicate mechanisms and so is much more rugged and tolerant of physical shock, and also requires less power. But that's only the beginning.

The way in which an SSD works is radically different from a hard disk is several respects:

  • An SSD stores data as electrostatic charges on a silicon chip whereas a hard disk stores it as patterns of magnetism in a spinning magnetic disk.
  • When you write data to a hard disk it simply overwrites any previous data in the same location on the disk by remagnetising it with the new data. But you can't write zeros to an SSD, you can only write ones. (All data consists of ones and zeros). Hence the area you want to write to has to be erased (set to all zeros) before you start.
  • You can't erase a little bit of an SSD here and a little bit there. It only allows you to erase quite a large block (measured in megabytes) of memory at a time. (This is simply one of the trade-offs which has allowed vast storage capacities to be achieved.)
  • On a hard disk, reading and writing take the same length of time (unless it's reading a marginal block requiring retries and error correction). Reading an SSD is really fast, but writing is considerably slower and erasing is slower still.
  • You can write to a hard disk as many times as you like without wearing out the magnetic surface, but writing to an SSD causes wear. An SSD will therefore choose for itself where to put your data and remember where that was, so as to spread out the wear. This is known as wear-levelling.

A consequence of all this is that as you create, edit and delete files, more and more blocks of storage will contain some data which is still current and quite a lot which is not (deleted and old versions of files, known as "stale" data). Eventually you would end up with no empty blocks to write new data to even though the SSD might only be half full of current data. To deal with this problem the operating system (Windows, MacOS or Linux) tells the SSD which data is no longer needed through a process known as TRIM. As a background task, the SSD then tries to consolidate the current data into fewer blocks, freeing up blocks which can be erased and made available for reuse. This process is known as garbage collection.

All this represents quite a lot of work for an SSD, keeping track of where it's put all your data and which bits of it are still needed and which aren't. So if anything goes wrong it can go very badly wrong, leaving the SSD totally confused and no longer able to operate. This might happen, for example, if power is suddenly lost or a power surge occurs while the SSD was in the middle of doing garbage collection. SSDs (certainly the better ones) are designed to cope with such an eventuality but it does occasionally happen. By contrast, when a hard disk fails it often does so more gracefully, giving increasingly frequent read errors and so allowing you more chance to recover your data. A hard disk may therefore be more suitable than an SSD for backup.

SSDs and the technologies they are built on are cursed with a veritable plague of technical terms and acronyms. With the speed of technological advance, some of these become irrelevant as fast as new ones appear. Probably the only significat ones in our context are:

  • SLC (Single Level Cell): each storage cell is either fully charged or empty, representing one bit, 0 or 1.
  • MLC (Multi-Level Cell): Each cell can be charged to one of 4 levels, representing two bits, 00, 01, 10 or 11.
  • TLC (Triple-Level Cell): Now, we have 8 levels in each cell, representing three bits.
  • QLC (Quad-Level Cell): I think you can see where we're going with this. 16 levels, four bits.

SLC is the most reliable, has the fastest read, write and erase speeds and the greatest endurance (i.e. the number of writes before it wears out), but is the most expensive and gives the lowest storage densities. MLC, TLC and QLC each give progressivlely greater capacities and lower costs traded for slower speeds and worse endurance. SLC is typically only used in datacentres and enterprise applications.

Problems and Solutions

An SSD should give trouble-free service and in particular it will be much less prone to damage through physical shocks than a hard disk. Nevertheless if it should fail it may do so catastrophically, with little chance of getting your data back. Bear this in mind if your data is vital to you, and make sure you back it up regularly.

SSD vendors often supply a SSD utility programme which can be found on their support website. This includes a health monitor program and S.M.A.R.T Diagnostic Tool. (S.M.A.R.T is an industry standard disk reliability test program. If any problems are encountered, run such a program first and contact the vendors' technical support immediately with the test results, which will greatly assist your support case.

If you are a Linux user there are utilities you can use described in this How-To-Geek article.

Intermittent freezing or blue screen

Intermittent freezing can sometimes be caused by a conflict in the way the host SATA controller deals with power management for the SSD. AHCI Link Power Management is a technique where the SATA AHCI controller puts the SATA link to the SSD into a very low power state when there is no activity for a period of time in order to save power (and battery life). The controller automatically puts the link back into active power state when the workload resumes. On some host computers this can cause the SSD to freeze intermittently when returning to a full power state. (Source: SanDisk)

External links

  • This page draws on material in the Wikipedia pages on Serial ATA and M.2.