LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-17-2012, 01:12 PM   #1
multiplicis
LQ Newbie
 
Registered: Jun 2012
Location: Italy
Distribution: Fedora
Posts: 3

Rep: Reputation: Disabled
Question Does Swap partition shorten the life of SSD?


I am reading "The PC-BSD Handbook version 9" (4.3 Using a custom partiton layout).

ftp://ftp.pcbsd.org/pub/handbook/9.0..._en_ver9.0.pdf

I have found this suggestion about swap space (related to FreeBSD/PC-BSD systems):

Quote:
The default size of the swap partition will be RAM (physical memory) size times 2 up to a maximum of 4GB. You can increase this if you want a larger swap partition (also known as a paging file or virtual memory in Windows), though this isn't really necessary as PC-BSD has a built-in daemon which monitors swap usage and will automatically add more as it is needed.

NOTE: if your hardware uses a solid state drive instead of a hard drive (e.g. an Asus Eee Netbook), do not create a swap partition as swap will shorten the life of the solid state drive.
Is this suggestion (about SSD) valid under Linux too? Can Linux work well without a swap space? I have a PC with 4GB RAM and Linux x86_64: can I eliminate my swap partition?

Last edited by multiplicis; 07-17-2012 at 01:13 PM.
 
Old 07-17-2012, 01:20 PM   #2
Lexus45
Member
 
Registered: Jan 2010
Distribution: Debian, Centos, Ubuntu, Slackware
Posts: 361
Blog Entries: 3

Rep: Reputation: 48
I'm not an expert about SSDs but I think there is some truth in this warning.
Not just swap shortens the life of SSD. The SSD's life is limited by a number of re-write cycles. On the swap partition this procedure is actively used. The same conditions may be achieved on a non-swap partition, it will be enought to re-write any information on it.

When I had an Asus EEEPc with SSD, I haven't used (created) the swap partition. And my other partitions were Ext2, the aim was not to use a journaling file system for reducing the re-write cycles.
 
Old 07-17-2012, 01:26 PM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Modern SSDs don't suffer from this outwearing in the same way as older ones (like the ones in the EeePC or the first generation SSDs for desktop PCs/laptops) did. Nowadays it is fairly safe to put swap space on the SSD.
 
1 members found this post helpful.
Old 07-17-2012, 01:31 PM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
I generally leave swap off of the SSD, as well as /tmp. I usually stick /tmp on tmpfs (ram), and swap on a traditional platter drive. Constant re-write cycles will reduce the life of the SSD, but I think that even with swap on the SSD it should still last longer than the rest of the system. That is assuming you're using a large enough SSD so you have plenty of free space to give TRIM some room to do its wear-leveling. If you only have a small amount of free space, there's only so much wear-leveling can do for you, and you'll reduce the lifespan much faster with swap or /tmp doing constant I/O.

Last edited by suicidaleggroll; 07-17-2012 at 01:32 PM.
 
Old 07-17-2012, 01:58 PM   #5
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by suicidaleggroll View Post
I generally leave swap off of the SSD, as well as /tmp. I usually stick /tmp on tmpfs (ram), and swap on a traditional platter drive. Constant re-write cycles will reduce the life of the SSD, but I think that even with swap on the SSD it should still last longer than the rest of the system. That is assuming you're using a large enough SSD so you have plenty of free space to give TRIM some room to do its wear-leveling. If you only have a small amount of free space, there's only so much wear-leveling can do for you, and you'll reduce the lifespan much faster with swap or /tmp doing constant I/O.
TRIM is not for wear-leveling, it's to let the SSD know which sectors of the disk are unused, so that it can increase the write speed for those sectors (and of course use them for wear leveling). Also, if you have constant I/O on swap you should rather think about buying more RAM than a SSD.
 
Old 07-17-2012, 03:50 PM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
Kind of a fine line still. I agree that a home user would be unlikely to wear out a ssd with a swap. They'd be more likely to replace the drive in a few years. Excess read writes will shorten the life of the ssd.

Linux has made some advances over the years in how it uses regular memory. Even what used to be time consuming clearing of ram to make room for programs isn't as bad as it was.

Personally I tend to never use a swap unless I know I am running huge programs. It is simple enough to create it without and add in a swap file later. (I assume BSD's can do that) I doubt a simple small home or small office setup would ever notice swap or not. Maybe on some large photo edits or maybe some larger database work.

Last edited by jefro; 07-17-2012 at 03:52 PM.
 
Old 07-17-2012, 04:28 PM   #7
joncr
Member
 
Registered: Jun 2012
Posts: 78

Rep: Reputation: Disabled
Can Linux work without swap? Sure, although some installers won't let you proceed without creating a swap partition.

But, if you load more programs/data than you have available RAM, that's when you discover why you need swap. Swap dates to the early days of Unix when memory was very expensive and entire multi-user systems ran off a single machine with RAM measured in small-number megabytes. Swap is nothing more than the substitution of physical memory (disk space) for RAM.

SSD's: A lot of outdated and unsubstantiated recommendations about SSD use are floating around. Most if it wants us to treat an SSD as being so fragile that if we actually use it, we will break it.

My advice is to check with the manufacturer your SSD. Mine says to treat mine just like any other drive. I have been and it's fine.
 
Old 07-17-2012, 04:55 PM   #8
snowday
Senior Member
 
Registered: Feb 2009
Posts: 4,667

Rep: Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411
The more you use anything, the faster it will wear out.
The question is, will you notice it? Modern high-quality SSDs are designed to last many years under constant use. Modern high-quality SSDs are arguably more reliable with a longer lifespan than traditional hard disk drives.

Much of the relevant information you'll find on the web was written for 1st generation netbooks like the EEE PC, these used cheap SSDs that were basically glorified thumb drives.
 
Old 07-17-2012, 06:02 PM   #9
nixblog
Member
 
Registered: May 2012
Posts: 426

Rep: Reputation: 53
If SSD's were so fragile still, how is it that datacentres are using them now in ever increasing amounts?

For average domestic use there should be no problem using swap on an SSD but having said that, RAM is king - the more the merrier
 
Old 07-17-2012, 07:33 PM   #10
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Quote:
Originally Posted by TobiSGD View Post
TRIM is not for wear-leveling, it's to let the SSD know which sectors of the disk are unused, so that it can increase the write speed for those sectors (and of course use them for wear leveling).
You are correct. Sorry I had a momentary brain fart and forgot the difference between TRIM and leveling.

Last edited by suicidaleggroll; 07-17-2012 at 07:35 PM.
 
Old 07-17-2012, 09:41 PM   #11
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
For the most part home users are buying the cheaper products. The products that may not be cutting edge or even less reliable. The data centers that use ssd's are more likely to use enterprise level ssd's and pay for the much cheaper and faster extra ram needed to not use swap at all. If anything, they'd fork over for the RevoDrives. I'd pay for the ram before I went with a swap file on a commercial system if I were to throw money for an ssd.
 
Old 09-03-2012, 12:42 PM   #12
mdlinuxwolf
Member
 
Registered: Dec 2006
Distribution: Mepis and Fedora, also Mandrake and SuSE PC-BSD Mint Solaris 11 express
Posts: 385

Rep: Reputation: 42
Swap is just so you can "get away" with not having enough RAM. I would just use lots of RAM, even if it means settling for a more modest CPU.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it practical to mount swap /var and /tmp on a fast SD card to save the SSD? FiftyOneFifty Linux - Desktop 5 02-10-2012 09:20 PM
SSD and 8GB RAM, What size SWAP? wulp Linux - General 9 08-25-2011 10:38 AM
[SOLVED] Should I move my Swap Partition from my SSD to the platter? skipf Linux - Hardware 2 12-05-2010 11:50 AM
Hard Drive Partition Management - Mandriva Double Partition with Swap File partition moshebagelfresser Linux - Hardware 2 05-23-2008 10:46 AM
shorten windos partition in knoppix help blackman890 Linux - Software 2 09-14-2005 04:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration