Swap revisited on SSD

These days it is customary to have a lot of RAM. The use of swap “in the old days” was mainly for when there was no more RAM to use.

My laptop currently has 24GB RAM of maximum supported 32GB. I first thought I wouldn’t need swap because of this. I also read somewhere that swap is not good for the SSD. When I was to make a fresh install of openSUSE 13.2 I decided to get rid of Swap. Then again this is a laptop and in order for Hibernation to work I need swap.

It is recommended to use as swap space of double system memory. However with an SSD of only 447GB I am reluctant to give 48GB of it to swap. I order for suspend to disk to work I would only need 24GB for swap and even that is a lot.

The partitioning for my running system is 2GB swap, 55GB for root and 390GB for home.

Found this page that does not recommend swap on SSD
http://www.makeuseof.com/tag/optimize-linux-ssds/

On Mon 17 Nov 2014 09:36:02 AM CST, DJViking wrote:

Found this page that does not recommend swap on SSD
http://www.makeuseof.com/tag/optimize-linux-ssds/

Hi
Turn the swap down via sysctl.conf;


vm.swappiness=1
vm.vfs_cache_pressure=50

I have 8GB of RAM and swap on my SSD’s, never touches it during normal
operation…

How many hours on the SSD, what are the specs on the SSD for daily
writes? How much are you writing a day to your SSD?

My systems are (3 with SSD’s) are running between 2.5 and 6.5GiB/s if
it’s within your SSD manufacturers specs little to worry about?


Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
SUSE Linux Enterprise Desktop 12 GNOME 3.10.1 Kernel 3.12.28-4-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

Interesting. I was unaware of this swappiness configuration. Read a little bit about this and I decided swappiness=0 would be preferable for me. I only want swap to be used for Suspend to disk or when there is a out of memory situation.

I have no idea of my SSD writes statistics or how to get any. I checked with smartmontools and there where a few things not supported, among them “Device Statistics (GP Log 0x04) not supported.”

Hi
I use smartctl and a script run by cron to calculate the writes.

If you run smartctl -a /dev/sdX can you post the output to see what info you have?

My OCZ Vertex4 is rated at 20GiB writes per day with a 5 year warranty…

Output from smartctl on my /dev/sda drive:


smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.17.2-2.g3788128-desktop] (SUSE RPM)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org


=== START OF INFORMATION SECTION ===
Model Family:     SandForce Driven SSDs
Device Model:     KINGSTON SH103S3480G
Serial Number:    50026B7223088197
LU WWN Device Id: 5 0026b7 223088197
Firmware Version: 501ABBF0
User Capacity:    480 103 981 056 bytes [480 GB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ATA8-ACS, ACS-2 T13/2015-D revision 3
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Mon Nov 17 16:05:05 2014 CET
SMART support is: Available - device has SMART capability.
SMART support is: Enabled


=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED


General SMART Values:
Offline data collection status:  (0x00) Offline data collection activity
                                        was never started.
                                        Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0) The previous self-test routine completed
                                        without error or no self-test has ever 
                                        been run.
Total time to complete Offline 
data collection:                (    0) seconds.
Offline data collection
capabilities:                    (0x7b) SMART execute Offline immediate.
                                        Auto Offline data collection on/off support.
                                        Suspend Offline collection upon new
                                        command.
                                        Offline surface scan supported.
                                        Self-test supported.
                                        Conveyance Self-test supported.
                                        Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                                        power-saving mode.
                                        Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                                        General Purpose Logging supported.
Short self-test routine 
recommended polling time:        (   1) minutes.
Extended self-test routine
recommended polling time:        (  48) minutes.
Conveyance self-test routine
recommended polling time:        (   2) minutes.
SCT capabilities:              (0x0001) SCT Status supported.


SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   104   104   050    Pre-fail  Always       -       0/7516005
  5 Retired_Block_Count     0x0033   100   100   003    Pre-fail  Always       -       0
  9 Power_On_Hours_and_Msec 0x0032   000   000   000    Old_age   Always       -       17922h+41m+57.410s
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       60
171 Program_Fail_Count      0x0032   000   000   000    Old_age   Always       -       0
172 Erase_Fail_Count        0x0032   000   000   000    Old_age   Always       -       0
174 Unexpect_Power_Loss_Ct  0x0030   000   000   000    Old_age   Offline      -       44
177 Wear_Range_Delta        0x0000   000   000   000    Old_age   Offline      -       1
181 Program_Fail_Count      0x0032   000   000   000    Old_age   Always       -       0
182 Erase_Fail_Count        0x0032   000   000   000    Old_age   Always       -       0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
194 Temperature_Celsius     0x0022   039   088   000    Old_age   Always       -       39 (Min/Max 19/88)
195 ECC_Uncorr_Error_Count  0x001c   120   120   000    Old_age   Offline      -       0/7516005
196 Reallocated_Event_Count 0x0033   100   100   003    Pre-fail  Always       -       0
201 Unc_Soft_Read_Err_Rate  0x001c   120   120   000    Old_age   Offline      -       0/7516005
204 Soft_ECC_Correct_Rate   0x001c   120   120   000    Old_age   Offline      -       0/7516005
230 Life_Curve_Status       0x0013   100   100   000    Pre-fail  Always       -       100
231 SSD_Life_Left           0x0013   100   100   010    Pre-fail  Always       -       0
233 SandForce_Internal      0x0000   000   000   000    Old_age   Offline      -       11737
234 SandForce_Internal      0x0032   000   000   000    Old_age   Always       -       8196
241 Lifetime_Writes_GiB     0x0032   000   000   000    Old_age   Always       -       8196
242 Lifetime_Reads_GiB      0x0032   000   000   000    Old_age   Always       -       17160



SMART Extended Comprehensive Error Log (GP Log 0x03) not supported


SMART Error Log not supported


SMART Extended Self-test Log (GP Log 0x07) not supported


SMART Self-test Log not supported


SMART Selective self-test log data structure revision number 0
Note: revision number not 1 implies that no selective self-test has ever been run
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.


SCT Data Table command not supported


SCT Error Recovery Control command not supported


Device Statistics (GP Log 0x04) not supported



Hi
Ahh so it shows the totals like my OCZ Agility :wink:

If you divide lifetime writes (attr 241) by power on hours (attr 9) gives GiB written per hour which is around .45 GiB IMHO nothing to worry about, since it’s showing no wear after 17K+ hours… When attr 231 start counting down, then be planning a new device.

Looking at the data here;
http://www.kingston.com/us/ssd/hyperx#sh103s3
Click on the specification link popup, they rate your device to write 1785TB (TBW), with interpretation in notes 3 and 4 at the bottom of the page I linked. Not sure what they mean at 3 drive writes per day? They also refer https://www.jedec.org/standards-documents/docs/jesd219a but you need a login…