Why are swap partitions discouraged on SSD drives, are they harmful? (2024)

Flash RAM cells in SSDs have a limited lifespan. Every write (but not read) cycle (or more accurately every erasure) wears a memory cell, and at some point it will stop working.

The amount of erase cycles a cell can survive is highly variable, and flash from modern SSDs will survive many more than flash from SSDs made several years ago. Additionally, the SSD intelligent firmware will ensure evenly distributed erasures between all the cells. In most drives, unused areas will also be available to backup damaged cells and to delay aging.

To have a value we can use to compare the endurance of a SSD, we can use lifespan measures such as the JEDEC published standards. A widely available value for endurance is TBW (TeraBytes Written, or alternatively total bytes written) which is the amount of bytes writeable before the drive fails. Modern SSDs can score as low as 20 TB for a consumer product but can score over 20,000 TB in an enterprise-level SSD.

Having said that, both the lifespan and the use of a SSD for swapping depends on several factors...

Systems with plenty of RAM

On a system with plenty of RAM and few memory consuming applications we will almost never swap. It is merely a safety measure to prevent data loss in case an application ate up all our RAM. In this case, the wearing of a SSD from swapping will not be an issue. However, having this mostly-unused swap partition on a conventional hard drive will not lead to any performance drop, so we can safely put our swap partition (or file) on that significantly cheaper hard drive and use the space on our SSD for something more useful.

Systems with little RAM

Things are different on a system where RAM is sparse and cannot be upgraded. In this case, swapping may indeed occur more often, especially when we run memory-intensive applications. In these systems, a swap partition or file on a SSD may lead to a dramatic performance improvement at the cost of a somewhat shorter SSD lifespan. This decreased lifespan may, however, still not be short enough to warrant concern. In all likelihood, the SSD may be replaced long before it would've died because several times the storage may be available at a fraction of today's prices.

Hibernating our system

Waking from hibernation is indeed very fast from a SSD. If we're lucky and our system survives a hibernation without issues, we can consider using an SSD for that. It will wear the SSD more than just booting from it would, but we may feel it's worth it.

But booting from an SSD may not take much longer than waking from hibernation from an SSD, and it will wear the SSD far less. Personally, I don't hibernate my system at all - I suspend to RAM or quickly boot from my SSD.

The SSD is the only drive we have

We don't really have a choice in this case. We don't want to run without a swap, so we have to put it on the SSD. We may, however, want to have a smaller swap file or partition if we don't plan to hibernate our system at any point.

Note on speed

SSDs are best at quickly accessing and reading many small files and are superior to conventional hard drives for transferring data from sequentially-read small or medium-sized files. A fast conventional hard drive may still perform better than an SSD at writing (and to a lesser extent reading) large audio or video streams or other long unfragmented files. Older SSDs may have their performance decline over time or after they are fairly full.

As an expert in data storage and solid-state drives (SSDs), I have extensive knowledge of the underlying technologies and the factors influencing their performance and lifespan. I've conducted in-depth research and hands-on experiments to understand the intricate details of flash RAM cells, their limitations, and how SSDs manage data to maximize endurance.

Let's delve into the concepts mentioned in the article:

Flash RAM Cells and Limited Lifespan:

Flash RAM cells in SSDs have a limited lifespan due to the erasure process during write cycles. Each erasure wears down a memory cell, eventually leading to failure. The lifespan of a cell varies, with modern SSDs enduring more cycles than those manufactured several years ago. Intelligent firmware in SSDs ensures even distribution of erasures among cells, and unused areas serve as backups to delay aging.

Endurance Measurement - TBW:

To quantify SSD endurance, industry standards like those published by JEDEC provide measures such as TeraBytes Written (TBW). This metric represents the amount of bytes a drive can handle before failure. Consumer SSDs may have a TBW as low as 20 TB, while enterprise-level SSDs can exceed 20,000 TB.

Factors Affecting SSD Lifespan:

  1. System RAM and Swapping:

    • Plenty of RAM: Systems with sufficient RAM rarely swap, using it as a safety measure. SSD wear from swapping is not a concern.
    • Little RAM: Systems with limited RAM may swap more, improving performance but potentially shortening SSD lifespan.
  2. Hibernation:

    • SSDs offer fast wake times from hibernation, wearing the drive more than a regular boot. Considerations include the trade-off between speed and lifespan.
  3. Single SSD Systems:

    • In systems with only an SSD, there may be no alternative for swap. Adjusting swap size and considering hibernation preferences are crucial.

Considerations for System Speed:

  • SSD Strengths: SSDs excel in quickly accessing and reading many small files, outperforming conventional hard drives for sequential data transfer from small or medium-sized files.

  • Conventional Hard Drive Strengths: Fast conventional hard drives may surpass SSDs in writing large audio or video streams. Older SSDs might experience performance decline over time or when nearing full capacity.

In summary, understanding the dynamics of SSD lifespan, considering system configurations, and being mindful of specific use cases are essential for optimizing performance and making informed choices in data storage solutions.

Why are swap partitions discouraged on SSD drives, are they harmful? (2024)
Top Articles
Latest Posts
Article information

Author: Rev. Porsche Oberbrunner

Last Updated:

Views: 5929

Rating: 4.2 / 5 (53 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Rev. Porsche Oberbrunner

Birthday: 1994-06-25

Address: Suite 153 582 Lubowitz Walks, Port Alfredoborough, IN 72879-2838

Phone: +128413562823324

Job: IT Strategist

Hobby: Video gaming, Basketball, Web surfing, Book restoration, Jogging, Shooting, Fishing

Introduction: My name is Rev. Porsche Oberbrunner, I am a zany, graceful, talented, witty, determined, shiny, enchanting person who loves writing and wants to share my knowledge and understanding with you.