LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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
Location: Kurgan, Russia
Distribution: Slackware, Ubuntu
Posts: 339
Blog Entries: 3

Rep: Reputation: 47
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: Hanover, Germany
Distribution: Gentoo
Posts: 15,357
Blog Entries: 2

Rep: Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979
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
Senior Member
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 2,597

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
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: Hanover, Germany
Distribution: Gentoo
Posts: 15,357
Blog Entries: 2

Rep: Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979
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
Guru
 
Registered: Mar 2008
Posts: 11,000

Rep: Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356
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: 73

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
snowpine
Senior Member
 
Registered: Feb 2009
Posts: 3,907

Rep: Reputation: 1044Reputation: 1044Reputation: 1044Reputation: 1044Reputation: 1044Reputation: 1044Reputation: 1044Reputation: 1044
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: 52
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
Senior Member
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 2,597

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
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
Guru
 
Registered: Mar 2008
Posts: 11,000

Rep: Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356
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: 365

Rep: Reputation: 34
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


All times are GMT -5. The time now is 02:12 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration