Page 1 of 2 12 LastLast
Results 1 to 16 of 18

Thread: SWAP files and SSDs

  1. #1
    The late but legendary peterb - Onward and Upward peterb's Avatar
    Join Date
    Aug 2005
    Location
    Looking down & checking on swearing
    Posts
    19,378
    Thanks
    2,892
    Thanked
    3,403 times in 2,693 posts

    SWAP files and SSDs

    Ive just replaced the hard drives on my server following a multiople hard drive failure and upgraded to Fedora 23.

    Rather than use a RAID 1 array for the OS, I´ve gone for an SSD on the basis that when it starts failing it is easy to rebuild. Consequently Im looking at moving user data that is held in /var to either a sub directory in /home, or move /var to thehard disk array.

    Hpowever, im in a qhandary about /swap. The RAM is 4Gb, and in general use the system is using about 75%. The swap is the same size and in general use is about 33% both figures are fine, but Im just wondering if I might be better to move the swap to the hard drive to minimize wear on the SSD and accept there may be a minimal hit on performance?

    The system doesn´t do anything strenuous, mainly a filestore with a web and mail server, and a bit of music streaming.

    Any thoughts?
    (\__/)
    (='.'=)
    (")_(")

    Been helped or just 'Like' a post? Use the Thanks button!
    My broadband speed - 750 Meganibbles/minute

  2. #2
    root Member DanceswithUnix's Avatar
    Join Date
    Jan 2006
    Location
    In the middle of a core dump
    Posts
    12,978
    Thanks
    778
    Thanked
    1,586 times in 1,341 posts
    • DanceswithUnix's system
      • Motherboard:
      • Asus X470-PRO
      • CPU:
      • 5900X
      • Memory:
      • 32GB 3200MHz ECC
      • Storage:
      • 2TB Linux, 2TB Games (Win 10)
      • Graphics card(s):
      • Asus Strix RX Vega 56
      • PSU:
      • 650W Corsair TX
      • Case:
      • Antec 300
      • Operating System:
      • Fedora 39 + Win 10 Pro 64 (yuk)
      • Monitor(s):
      • Benq XL2730Z 1440p + Iiyama 27" 1440p
      • Internet:
      • Zen 900Mb/900Mb (CityFibre FttP)

    Re: SWAP files and SSDs

    I wouldn't worry about it.

    use

    smartctl -a /dev/sda

    or whatever and get the total LBAs written. Have another look after a day or even a week, that will get you how many sectors per day you are writing.

    I think with most modern drives if you are up to about 20GB per day then you should worry if you intend keeping the ssd for more than 5 years

  3. Received thanks from:

    peterb (29-09-2016)

  4. #3
    The late but legendary peterb - Onward and Upward peterb's Avatar
    Join Date
    Aug 2005
    Location
    Looking down & checking on swearing
    Posts
    19,378
    Thanks
    2,892
    Thanked
    3,403 times in 2,693 posts

    Re: SWAP files and SSDs

    Just swapped it over and rebooted, and of course no swap is being used! However, this is the output from smartctl for the SSD - its been in use for about 10 days now (so the powerup time isn't displaying correctly for some reason)

    Code:
    === START OF INFORMATION SECTION ===
    Model Family:     SandForce Driven SSDs
    Device Model:     SanDisk SDSSDA240G
    Serial Number:    153948405606
    LU WWN Device Id: 5 001b44 ee39f3b66
    Firmware Version: Z22000RL
    User Capacity:    240,057,409,536 bytes [240 GB]
    Sector Size:      512 bytes logical/physical
    Rotation Rate:    Solid State Device
    Form Factor:      1.8 inches
    Device is:        In smartctl database [for details use: -P show]
    ATA Version is:   ACS-2 T13/2015-D revision 3
    SATA Version is:  SATA 3.2, 6.0 Gb/s (current: 3.0 Gb/s)
    Local Time is:    Thu Sep 29 13:42:32 2016 BST
    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: 			 (0x71) SMART execute Offline immediate.
    					No Auto Offline data collection support.
    					Suspend Offline collection upon new
    					command.
    					No Offline surface scan supported.
    					Self-test supported.
    					Conveyance Self-test supported.
    					Selective Self-test supported.
    SMART capabilities:            (0x0002)	Does not save 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: 	 (   2) minutes.
    Extended self-test routine
    recommended polling time: 	 (  10) minutes.
    Conveyance self-test routine
    recommended polling time: 	 (   2) minutes.
    
    SMART Attributes Data Structure revision number: 1
    Vendor Specific SMART Attributes with Thresholds:
    ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
      5 Retired_Block_Count     0x0032   100   100   000    Old_age   Always       -       0
      9 Power_On_Hours_and_Msec 0x0032   026   100   000    Old_age   Always       -       26h+00m+00.000s
     12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       29
    166 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       1
    167 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       0
    168 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       5
    169 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       21
    170 Reserve_Block_Count     0x0032   100   100   000    Old_age   Always       -       0
    171 Program_Fail_Count      0x0032   100   100   000    Old_age   Always       -       0
    172 Erase_Fail_Count        0x0032   100   100   000    Old_age   Always       -       0
    173 Unknown_SandForce_Attr  0x0032   100   100   ---    Old_age   Always       -       3
    174 Unexpect_Power_Loss_Ct  0x0032   100   100   000    Old_age   Always       -       19
    187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
    194 Temperature_Celsius     0x0022   068   100   000    Old_age   Always       -       32 (Min/Max 0/41)
    199 SATA_CRC_Error_Count    0x0032   100   100   000    Old_age   Always       -       0
    230 Life_Curve_Status       0x0032   100   100   000    Old_age   Always       -       0
    232 Available_Reservd_Space 0x0033   100   100   004    Pre-fail  Always       -       100
    233 SandForce_Internal      0x0032   100   100   000    Old_age   Always       -       833
    241 Lifetime_Writes_GiB     0x0030   253   253   000    Old_age   Offline      -       795
    242 Lifetime_Reads_GiB      0x0030   253   253   000    Old_age   Offline      -       28
    
    SMART Error Log Version: 1
    No Errors Logged
    
    SMART Self-test log structure revision number 1
    No self-tests have been logged.  [To run self-tests, use: smartctl -t]
    
    SMART Selective self-test log data structure revision number 1
     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):
    (\__/)
    (='.'=)
    (")_(")

    Been helped or just 'Like' a post? Use the Thanks button!
    My broadband speed - 750 Meganibbles/minute

  5. #4
    Senior Member
    Join Date
    Apr 2004
    Location
    The Third Foundation
    Posts
    919
    Thanks
    2
    Thanked
    99 times in 91 posts

    Re: SWAP files and SSDs

    800GB over 10 days is fairly heavy use, that's ~80TB over three years. Accelerated endurance tests (on home drives) usually find a few hundred terabytes before drives wear out but with the effects of age you could potentially be looking at a dead drive towards the end of five years.

  6. Received thanks from:

    peterb (29-09-2016)

  7. #5
    The late but legendary peterb - Onward and Upward peterb's Avatar
    Join Date
    Aug 2005
    Location
    Looking down & checking on swearing
    Posts
    19,378
    Thanks
    2,892
    Thanked
    3,403 times in 2,693 posts

    Re: SWAP files and SSDs

    Ten days useage has been atypical though as there was an operating system to install plus all the updates and applications, so that should be a one off.

    I have moved the swap file to the hard drives, and I think I'll move the more dynamic directories to there as well. That will include the mail folders, and possible the database files for the web server, although they are more read from than write to, so maybe not such an issue. Log files are the other area where a lot of writes may take place, so they could be moved.

    I'll probably just make a director like var1 on the hard drive and symlink from the original location, rather go completely off piste with the configuration.

    But then 5 years isn't bad, my existing hard drives haven't lasted that long.
    (\__/)
    (='.'=)
    (")_(")

    Been helped or just 'Like' a post? Use the Thanks button!
    My broadband speed - 750 Meganibbles/minute

  8. #6
    root Member DanceswithUnix's Avatar
    Join Date
    Jan 2006
    Location
    In the middle of a core dump
    Posts
    12,978
    Thanks
    778
    Thanked
    1,586 times in 1,341 posts
    • DanceswithUnix's system
      • Motherboard:
      • Asus X470-PRO
      • CPU:
      • 5900X
      • Memory:
      • 32GB 3200MHz ECC
      • Storage:
      • 2TB Linux, 2TB Games (Win 10)
      • Graphics card(s):
      • Asus Strix RX Vega 56
      • PSU:
      • 650W Corsair TX
      • Case:
      • Antec 300
      • Operating System:
      • Fedora 39 + Win 10 Pro 64 (yuk)
      • Monitor(s):
      • Benq XL2730Z 1440p + Iiyama 27" 1440p
      • Internet:
      • Zen 900Mb/900Mb (CityFibre FttP)

    Re: SWAP files and SSDs

    Quote Originally Posted by peterb View Post
    Ten days useage has been atypical though as there was an operating system to install plus all the updates and applications, so that should be a one off.

    I have moved the swap file to the hard drives, and I think I'll move the more dynamic directories to there as well. That will include the mail folders, and possible the database files for the web server, although they are more read from than write to, so maybe not such an issue. Log files are the other area where a lot of writes may take place, so they could be moved.

    I'll probably just make a director like var1 on the hard drive and symlink from the original location, rather go completely off piste with the configuration.

    But then 5 years isn't bad, my existing hard drives haven't lasted that long.
    As I said, I really would leave it a day or two and get a delta between the two readings.

    SSD wear for all but the most intense use is a non issue.

  9. Received thanks from:

    peterb (29-09-2016)

  10. #7
    mush-mushroom b0redom's Avatar
    Join Date
    Oct 2005
    Location
    Middlesex
    Posts
    3,494
    Thanks
    195
    Thanked
    383 times in 292 posts
    • b0redom's system
      • Motherboard:
      • Some iMac thingy
      • CPU:
      • 3.4Ghz Quad Core i7
      • Memory:
      • 24GB
      • Storage:
      • 3TB Fusion Drive
      • Graphics card(s):
      • nViidia GTX 680MX
      • PSU:
      • Some iMac thingy
      • Case:
      • Late 2012 pointlessly thin iMac enclosure
      • Operating System:
      • OSX 10.8 / Win 7 Pro
      • Monitor(s):
      • Dell 2713H
      • Internet:
      • Be+

    Re: SWAP files and SSDs

    Might also be worth adding an extra 4GB? In the grand scheme of things it's a negligible expense, and chances are it would drop swap down to zero for most of the time?

  11. Received thanks from:

    peterb (30-09-2016)

  12. #8
    Anthropomorphic Personification shaithis's Avatar
    Join Date
    Apr 2004
    Location
    The Last Aerie
    Posts
    10,857
    Thanks
    645
    Thanked
    872 times in 736 posts
    • shaithis's system
      • Motherboard:
      • Asus P8Z77 WS
      • CPU:
      • i7 3770k @ 4.5GHz
      • Memory:
      • 32GB HyperX 1866
      • Storage:
      • Lots!
      • Graphics card(s):
      • Sapphire Fury X
      • PSU:
      • Corsair HX850
      • Case:
      • Corsair 600T (White)
      • Operating System:
      • Windows 10 x64
      • Monitor(s):
      • 2 x Dell 3007
      • Internet:
      • Zen 80Mb Fibre

    Re: SWAP files and SSDs

    I've been using some old gen2 Intel SSDs as array caches (ZFS read cache and then as a Storage Spaces tier) for almost 3 years, caching 3TB volumes serving a dozen-or-so VMs. They have taken an absolute hammering on a day-to-day basis and were system drives in my PC before being re-provisioned.

    I wouldn't worry too much about the writes from a single machine.

    The idea to add some more RAM is also good, less page faults for a very small outlay.
    Main PC: Asus Rampage IV Extreme / 3960X@4.5GHz / Antec H1200 Pro / 32GB DDR3-1866 Quad Channel / Sapphire Fury X / Areca 1680 / 850W EVGA SuperNOVA Gold 2 / Corsair 600T / 2x Dell 3007 / 4 x 250GB SSD + 2 x 80GB SSD / 4 x 1TB HDD (RAID 10) / Windows 10 Pro, Yosemite & Ubuntu
    HTPC: AsRock Z77 Pro 4 / 3770K@4.2GHz / 24GB / GTX 1080 / SST-LC20 / Antec TP-550 / Hisense 65k5510 4K TV / HTC Vive / 2 x 240GB SSD + 12TB HDD Space / Race Seat / Logitech G29 / Win 10 Pro
    HTPC2: Asus AM1I-A / 5150 / 4GB / Corsair Force 3 240GB / Silverstone SST-ML05B + ST30SF / Samsung UE60H6200 TV / Windows 10 Pro
    Spare/Loaner: Gigabyte EX58-UD5 / i950 / 12GB / HD7870 / Corsair 300R / Silverpower 700W modular
    NAS 1: HP N40L / 12GB ECC RAM / 2 x 3TB Arrays || NAS 2: Dell PowerEdge T110 II / 24GB ECC RAM / 2 x 3TB Hybrid arrays || Network:Buffalo WZR-1166DHP w/DD-WRT + HP ProCurve 1800-24G
    Laptop: Dell Precision 5510 Printer: HP CP1515n || Phone: Huawei P30 || Other: Samsung Galaxy Tab 4 Pro 10.1 CM14 / Playstation 4 + G29 + 2TB Hybrid drive

  13. Received thanks from:

    peterb (30-09-2016)

  14. #9
    The late but legendary peterb - Onward and Upward peterb's Avatar
    Join Date
    Aug 2005
    Location
    Looking down & checking on swearing
    Posts
    19,378
    Thanks
    2,892
    Thanked
    3,403 times in 2,693 posts

    Re: SWAP files and SSDs

    So, 24 hours later, after a reboot when I moved the swap file, and with the Cinnamon desktop loaded but locked with one user logged on, firefox with a few tabs open

    Code:
    241 Lifetime_Writes_GiB     0x0030   253   253   000    Old_age   Offline      -       796
    Ram useage 2.4GiB and swap in use 4.3MiB (.1%)

    So looking more typical. I have thought about more RAM, but although the cost is minimal, it seems overekill for a lightly loaded machine that spends most of its time in multi-user.target mode (aka run level 3 )

    I will move the vhosts mail directory though, apart from anything else, it will make the backup strategy simpler as it will be backed up with all the home directories, and the same goes for the httpd document root directory although they are mostly read from, rather than written to.

    Edit: Mobo only has two memory slots, but a couple of 4GB sticks are only around £40 (Corsair XMS)
    (\__/)
    (='.'=)
    (")_(")

    Been helped or just 'Like' a post? Use the Thanks button!
    My broadband speed - 750 Meganibbles/minute

  15. #10
    HEXUS.timelord. Zak33's Avatar
    Join Date
    Jul 2003
    Location
    I'm a Jessie
    Posts
    35,176
    Thanks
    3,121
    Thanked
    3,173 times in 1,922 posts
    • Zak33's system
      • Storage:
      • Kingston HyperX SSD, Hitachi 1Tb
      • Graphics card(s):
      • Nvidia 1050
      • PSU:
      • Coolermaster 800w
      • Case:
      • Silverstone Fortress FT01
      • Operating System:
      • Win10
      • Internet:
      • Zen FTC uber speedy

    Re: SWAP files and SSDs

    Am I the only person who turns them off ?

    Cos I do

    If I have 8gb or more.. the swap file is off

    Quote Originally Posted by Advice Trinity by Knoxville
    "The second you aren't paying attention to the tool you're using, it will take your fingers from you. It does not know sympathy." |
    "If you don't gaffer it, it will gaffer you" | "Belt and braces"

  16. #11
    The late but legendary peterb - Onward and Upward peterb's Avatar
    Join Date
    Aug 2005
    Location
    Looking down & checking on swearing
    Posts
    19,378
    Thanks
    2,892
    Thanked
    3,403 times in 2,693 posts

    Re: SWAP files and SSDs

    Quote Originally Posted by Zak33 View Post
    Am I the only person who turns them off ?

    Cos I do

    If I have 8gb or more.. the swap file is off
    Depends what you are doing - it can be useful if you occasionally do memory intensive tasks.

    Just looking at the system now, I´m using 70% Ram and 0.2% swqap - but now swap is on the hard drive, it isn´t really an issue. (And the CPU cores are running at 2% )
    (\__/)
    (='.'=)
    (")_(")

    Been helped or just 'Like' a post? Use the Thanks button!
    My broadband speed - 750 Meganibbles/minute

  17. #12
    root Member DanceswithUnix's Avatar
    Join Date
    Jan 2006
    Location
    In the middle of a core dump
    Posts
    12,978
    Thanks
    778
    Thanked
    1,586 times in 1,341 posts
    • DanceswithUnix's system
      • Motherboard:
      • Asus X470-PRO
      • CPU:
      • 5900X
      • Memory:
      • 32GB 3200MHz ECC
      • Storage:
      • 2TB Linux, 2TB Games (Win 10)
      • Graphics card(s):
      • Asus Strix RX Vega 56
      • PSU:
      • 650W Corsair TX
      • Case:
      • Antec 300
      • Operating System:
      • Fedora 39 + Win 10 Pro 64 (yuk)
      • Monitor(s):
      • Benq XL2730Z 1440p + Iiyama 27" 1440p
      • Internet:
      • Zen 900Mb/900Mb (CityFibre FttP)

    Re: SWAP files and SSDs

    Quote Originally Posted by Zak33 View Post
    Am I the only person who turns them off ?

    Cos I do

    If I have 8gb or more.. the swap file is off
    Not on Linux.

    There are always some pages that the system hardly touches, and they get paged out which frees up a bit of ram for more useful tasks. It is basically free ram, given that storage is cheaper than ram

    I don't bother with the *recommended* amount of swap. I mean, if you back 4GB of ram with another 4GB of swap that isn't so silly, but 16GB of swap because you have 16GB of ram? It takes a long time just to do a linear read of 16GB of ssd let alone disk, so if I am swapping into tens of GB I would probably rather give up as that task is going to take so long I am probably better off ordering more ram and trying again tomorrow

  18. #13
    Be wary of Scan Dashers's Avatar
    Join Date
    Jun 2016
    Posts
    1,079
    Thanks
    40
    Thanked
    137 times in 107 posts
    • Dashers's system
      • Motherboard:
      • Gigabyte GA-X99-UD4
      • CPU:
      • Intel i7-5930K
      • Memory:
      • 48GB Corsair DDR4 3000 Quad-channel
      • Storage:
      • Intel 750 PCIe SSD; RAID-0 x2 Samsung 840 EVO; RAID-0 x2 WD Black; RAID-0 x2 Crucial MX500
      • Graphics card(s):
      • MSI GeForce GTX 1070 Ti
      • PSU:
      • CoolerMaster Silent Pro M2 720W
      • Case:
      • Corsair 500R
      • Operating System:
      • Windows 10
      • Monitor(s):
      • Philips 40" 4K AMVA + 23.8" AOC 144Hz IPS
      • Internet:
      • Zen FTTC

    Re: SWAP files and SSDs

    My understanding is that most modern OS' that are aware of an SSD being in place are more careful about writing swap data into.

    I used to disable swap files in the past, but I found a number of things used to go screwy as they were expected. Forcing them to be small size worked, but as above, management became a bit more intelligent so there shouldn't be so much of a need these days.

    I guess if you knew you were always going to be in a paging situation but you didn't want to swap and hit out-of-memory errors instead, then you could turn them off.

  19. Received thanks from:

    peterb (03-10-2016)

  20. #14
    The late but legendary peterb - Onward and Upward peterb's Avatar
    Join Date
    Aug 2005
    Location
    Looking down & checking on swearing
    Posts
    19,378
    Thanks
    2,892
    Thanked
    3,403 times in 2,693 posts

    Re: SWAP files and SSDs

    And just had another peek..

    Code:
    241 Lifetime_Writes_GiB     0x0030   253   253   000    Old_age   Offline      -       798
    (\__/)
    (='.'=)
    (")_(")

    Been helped or just 'Like' a post? Use the Thanks button!
    My broadband speed - 750 Meganibbles/minute

  21. #15
    root Member DanceswithUnix's Avatar
    Join Date
    Jan 2006
    Location
    In the middle of a core dump
    Posts
    12,978
    Thanks
    778
    Thanked
    1,586 times in 1,341 posts
    • DanceswithUnix's system
      • Motherboard:
      • Asus X470-PRO
      • CPU:
      • 5900X
      • Memory:
      • 32GB 3200MHz ECC
      • Storage:
      • 2TB Linux, 2TB Games (Win 10)
      • Graphics card(s):
      • Asus Strix RX Vega 56
      • PSU:
      • 650W Corsair TX
      • Case:
      • Antec 300
      • Operating System:
      • Fedora 39 + Win 10 Pro 64 (yuk)
      • Monitor(s):
      • Benq XL2730Z 1440p + Iiyama 27" 1440p
      • Internet:
      • Zen 900Mb/900Mb (CityFibre FttP)

    Re: SWAP files and SSDs

    Seems insignificant.

    I googled on this earlier, found a Debian page on SSD tuning which recommended avoiding the cheaper TLC nand based SSDs if you were writing 40 to 50GB per day.

  22. Received thanks from:

    peterb (01-10-2016)

  23. #16
    The late but legendary peterb - Onward and Upward peterb's Avatar
    Join Date
    Aug 2005
    Location
    Looking down & checking on swearing
    Posts
    19,378
    Thanks
    2,892
    Thanked
    3,403 times in 2,693 posts

    Re: SWAP files and SSDs

    The amount of swap used anyway was neglible this morning, and I've moved the mail folders to the hard drives, so there shouldn't be much write activity now, apart from log files.

    Still getting to grips with the configuration changes from Apache 2.2 to 2.4, but change is progress - isn't it?
    (\__/)
    (='.'=)
    (")_(")

    Been helped or just 'Like' a post? Use the Thanks button!
    My broadband speed - 750 Meganibbles/minute

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •