Does it still make sense to use a good old magnetic disk for this purpose, maybe a RAID 0 configuration?
-
1Please [edit] and clarify your question. RAID 0 requires at least *two* disks. – DavidPostill Dec 19 '20 at 22:13
-
Yes, of course it requires more disks. But this is not really relevant, it is just to improve the speed, since magnetic storage is much slower than SSD. This RAID 0 is not a necessity, though. I just wonder if there are other alternatives now. Perhaps I should just install a small 'scratch SSD' for swap partitions and small files that change frequently. Then I can replace this when it starts to fail. I ask this question, because there may be a better way I don't know of? – user2943111 Dec 19 '20 at 22:18
1 Answers
What kind of storage would nowadays be good for swap partitions (Linux, Windows)?
SSDs, preferably NVMe.
If NVMe SSD is used, how will this impact longevity?
No it does not.
Long answer. Let's recap our memory.
You only need as much memory as you use. Except when there is caching going on, then more memory is better, and caching will improve speed.
Not having enough memory will crash programs. Operating systems use swap or page files to prevent this, by using a drive as memory. With swap, it'll perform a lot swapping.
Hard disk drives (HDD) are slow to read, slower to write. They should theoretically last forever, but they have a limit.
Solid state drives (SSD) are fast. NVMe variants are much faster. They are known for limited life-span (write span), but the technology has improved to the point that they would last longer than their hard disk counter-parts in similar usage.
With HDDs, swap has potential to cause thrashing, where you computer becomes a snail.
With SSDs, it is fast enough to not cause thrashing.
Swap is not a replacement for active/intensive RAM. Swap is slower, write-limited extra RAM for non memory-intensive purposes, like inactive data that you don't want removed from memory eg. loaded websites or IDE instances.
Conclusion
You should put swap only on SSDs. Put it on HDD only if you are willing to accept the potential for thrashing, in return for more swap space. If you are still worried about SSD's lifespan, use "scratch SSD" that you can replace regularly, but I recommend trying to reduce swapping first, by eg. having more RAM.
- 136
- 4
-
1I think you get trashing with SSD also if you use a lot of RAM and have many page swaps, especially if you do random access to that memory, read a few bytes from a page and then need to swap in another page (OS does this). With SSD, the performance penalty is less severe (since swapping goes faster, but it still happens), at the expense of wearing out the SDD. I read the advice if you use ext4 file system (for other partitions than swap), you are advised to switch off journaling to alleviate wear. – user2943111 Dec 27 '20 at 15:16
-
Having more RAM than you actually use can prevent page swaps from happening. So more RAM is good, but I am limited to 64GB. – user2943111 Dec 27 '20 at 15:25
-
3Swap is NOT a replacement for RAM in active usage, it helps with processes you have running but not memory intensive, eg. idle programs, to not crash.If you are swapping enough to cause thrashing on an SSD, you need more RAM. If you swap too much, it's not good for the swap drive, so you will want more RAM. – Default Dec 28 '20 at 04:34