The Notebook Review forums were hosted by TechTarget, who shut down them down on January 31, 2022. This static read-only archive was pulled by NBR forum users between January 20 and January 31, 2022, in an effort to make sure that the valuable technical information that had been posted on the forums is preserved. For current discussions, many NBR forum users moved over to NotebookTalk.net after the shutdown.
Problems? See this thread at archive.org.

    Linux on SSD, swap?

    Discussion in 'Linux Compatibility and Software' started by Primes, Dec 10, 2012.

  1. Primes

    Primes Notebook Deity

    Reputations:
    919
    Messages:
    1,736
    Likes Received:
    718
    Trophy Points:
    131
    I'm getting a SSD for my aging laptop (P8600, 4Gb ram), but having a hard time figuring out how much swap to allocate.

    I know the 'default' recommendation for Linux is usually 2x Ram, but I have read all sort of 'tips' that say:
    - don't use swap on a SSD, you want to minimize writes.
    - amount of swap should be 1x size of ram if you plan to hibernate.
    - some distros require swap to install, so just go with something small like 256MB.

    What do you guys recommend?

    While I have used hibernation in the past, its not a big deal if I don't use it. I do use suspend though.
    I also plan to do some tweaks such as 'noatime', adjusting swappiness, and perhaps even turning logging off to save on writes.

    Update here: http://forum.notebookreview.com/lin...ware/699790-linux-ssd-swap-2.html#post9229971
     
  2. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
    I don't use any swap on my SSD systems, because they have enough RAM to do what I want them to do. If you need swap, I would suggest using a swapfile, not a swap partition, so that you can adjust its size as needed. You are paying for speed on an SSD so wasting any of it would be a shame.

    At least in the debian installer it will warn you if you don't have a swap partition, but will let you continue anyway.
     
  3. ajkula66

    ajkula66 Courage and Consequence

    Reputations:
    3,018
    Messages:
    3,198
    Likes Received:
    2,318
    Trophy Points:
    231
    I'd agree with that one - no swap if at all possible.

    A lot will depend on the tasks that you throw at that (unknown to us) laptop...

    Since I don't allow myself to have more than one dedicated Linux box at the time, my recent experiences would say that you have plenty of RAM for "average" use.

    My previous Linux box was a Panasonic CF-W7 with 3GB RAM, running Mint 12 on a Crucial C300 SSD. It was ridiculously fast for its limited specs, but I haven't thrown any *heavy* tasks at it.

    The current Linux box is a customized ThinkPad T43 with 2GB RAM, running Mint Debian on a Crucial M4. Doesn't feel old at all, and it should...:D

    All in all, a good SSD + Linux on an older machine is a winning combo.

    My $0.02 only...
     
  4. JOSEA

    JOSEA NONE

    Reputations:
    4,013
    Messages:
    3,521
    Likes Received:
    170
    Trophy Points:
    131
    If you are going with Ubuntu 12.X this article may also be of some help https://help.ubuntu.com/community/SwapFaq I am about to abandon win 7 on my asus and go this route & appreciate the concise answers in this thread.
     
  5. itoffshore

    itoffshore Notebook Guru

    Reputations:
    26
    Messages:
    52
    Likes Received:
    6
    Trophy Points:
    16
    Do NOT setup a Swap Partition on an SSD (with 4GB of RAM it would probably never be used), think about using ZRAM (running compressed swap in ram).

    You can further reduce disk writes (& extend the life of your SSD) by making /tmp a symbolic link pointing to /var/tmp & add the following to /etc/fstab so that temporary files also exist only in ram:
    Code:
    tmpfs /var/tmp tmpfs defaults,noatime,noexec,nodev,nosuid,mode=1777  0  0
     
  6. RMXO

    RMXO Notebook Deity

    Reputations:
    234
    Messages:
    722
    Likes Received:
    242
    Trophy Points:
    56
    there is an option to create a swap file on the SSD but I'm not as knowledgeable to know if that is good or bad.

    I've had the luxury of having a SSD & a mechanical HDD (in the optical bay) to put swap on. Maybe that is something to consider if possible.
     
  7. OtherSongs

    OtherSongs Notebook Evangelist

    Reputations:
    113
    Messages:
    640
    Likes Received:
    1
    Trophy Points:
    31
    6 weeks of this thread.

    So little that has made any sense.

    For anyone (me) using a SSD, my own take is to not use a swap partition.

    Then try setting up your 1st choice Linux distro.

    If that doesn't work (for sleep/hibernate), then move to installing your 2nd choice linux distro.

    Etc. etc. until you find a distro that provides a workable sleep/hibernate mode with a swap file, and not with a swap partition. Meaning something like what Windows XP and 7 do with regard to S3 sleep, where computer's memory is kept active (during sleep) via A/C power.

    That's my take so far (with zero Linux experience).
     
  8. cri-cri

    cri-cri Notebook Consultant

    Reputations:
    43
    Messages:
    111
    Likes Received:
    0
    Trophy Points:
    30
    Hmmm... care to elaborate on that ?

    Likewise, in linux, S3 Sleep, AKA Suspend to RAM does not require a swap partition/file. That's why it's called suspend to RAM. For S4 Sleep AKA Suspend to Disk AKA Hibernate a swap partition OR a swap file is required. Either will do.
     
  9. OtherSongs

    OtherSongs Notebook Evangelist

    Reputations:
    113
    Messages:
    640
    Likes Received:
    1
    Trophy Points:
    31
    I have 16GB of memory on my notebook.

    As I understand it, for me a swap partition would need to be a minimum of ~ 17GB.

    Since I'm only using SSD for storage (and no HDD), a 17GB partition, for only swap, looks like a very poor way to set up partitions for Linux use with expensive SSD space.

    You did notice the terms "SSD" and "swap" in this thread title??? :)

    BTW does current Ubuntu 12.10 offer S4, or is that specific to Windows?
     
  10. cri-cri

    cri-cri Notebook Consultant

    Reputations:
    43
    Messages:
    111
    Likes Received:
    0
    Trophy Points:
    30
    Correct. That is, only if you plan to hibernate (suspend to disk). Otherwise there's no point to set up swap space, IMO, seeing the amount of RAM you got there.

    I own a SSD (no HDD either) but I'm no SSD expert, so I'm not sure how writes on a SWAP file differ from writes on a SWAP partition (if at all). I assume it's pretty much the same thing considering the huge amount of writes needed to wear the SSD. As to the "poor way" of using expensive SSD space for SWAP in linux... Windows does that in a "poor way" too... it uses a file called hiberfil.sys which is always the same size of the installed RAM. Whether you plan to use suspend to disk or not, that file is there, eating up expensive SSD space unless you disable hibernation and delete the file. I don't see how any OS could suspend to disk without actually writing the content of RAM to disk.

    S4 is a global power state defined in the ACPI specs. GNU/Linux is ACPI compliant so all modern distros should support suspend to disk. I don't use Ubuntu but check their wiki: Ubuntu suspend to disk.
     
  11. PopLap

    PopLap Notebook Evangelist

    Reputations:
    22
    Messages:
    395
    Likes Received:
    0
    Trophy Points:
    30
    I will say this about the concerns of writes on an SSD and SWAP. All consumer SSD made in the past couple of years have TRIM and garbage control which for the most part does negate most concern about write cycles, if your using SWAP extensively then it may pose a problem but it has to be far more then any common use even with extensive use of S4 usage. SSDs are built far better then they use to be and have overcome the problems that they have had in the past.

    Personally i would use a SWAP file on an SSD just to save space.
     
  12. squelchy451

    squelchy451 Notebook Consultant

    Reputations:
    9
    Messages:
    104
    Likes Received:
    0
    Trophy Points:
    30
    I have 4 GB of RAM and have 4 GB on my puny 36GB SSD. I hibernate often, but I close all applications before doing so.
    At one time I had no swap space (and hence didn't hibernate) but I think 1x RAM is a good rule of thumb.
     
  13. Charr

    Charr Notebook Deity

    Reputations:
    415
    Messages:
    1,564
    Likes Received:
    0
    Trophy Points:
    55
    If you get an SSD with a good controller, you really won't need to worry about writes on it. It'll far outlast it usefulness with normal write operations to it.

    As for swap on an SSD, I recommend having a least a little available. 4GB of RAM is pretty tight, and you could easily full that up with a couple of tasks. My laptop is nearly the same as yours (T400, P8600 & 4GB RAM) and it isn't unusual for it to swap 100MB on occasion during compiles (on tmpfs) with web browsing and music playing. I use equal size swap to RAM, and use TuxOnIce for hibernating.

    Don't forget you can always tune your vm.swappiness if you feel you're swapping too much.

    If you do get an SSD, make sure when you format it that the filesystem's sectors are aligned to the drive.
     
  14. Primes

    Primes Notebook Deity

    Reputations:
    919
    Messages:
    1,736
    Likes Received:
    718
    Trophy Points:
    131
    I realized I never really followed up with this thread, so for anyone interested, here are some links to check out concerning Linux on SSD:

    Solid State Drives and Linux
    Four Tweaks for Using Linux with Solid State Drives | Tombuntu
    How to maximise SSD performance with Linux
    https://wiki.archlinux.org/index.php/Maximizing_Performance#Swappiness

    I just did a fresh install of Mint 15 and went with no swapfile and these tweaks from my first link:

     
  15. angellsl

    angellsl Newbie

    Reputations:
    0
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    5
    I enabled trim and swapfile on a ext4 ssd partition. After a year, still going strong. 12gb ram and 12gb swapfile

    Sent from my SGH-T889 using Tapatalk 2
     
  16. tommytomatoe

    tommytomatoe Notebook Evangelist

    Reputations:
    59
    Messages:
    579
    Likes Received:
    2
    Trophy Points:
    31
    Have you monitored your ram and swap usage? With 12gb of RAM you are more than likely never using swap. Unless you hibernate that amount of swap is unnecessary :)

    Sent from my EVO using Tapatalk 2
     
  17. nipsen

    nipsen Notebook Ditty

    Reputations:
    694
    Messages:
    1,686
    Likes Received:
    131
    Trophy Points:
    81
    ^that's basically the long and the short of it. When you have more ram than you're using, the swap-file isn't really used all that much. You write down some of the marked files, if any, that always are cached. And some apps might specifically start to index resources. But most of the time you're just not using it.

    Has been a lot of discussion about this, though. And the way cache-misses are typically used in Windows often has people insist, for somewhat good reason, that things will launch faster and index easier when a swap-file is there.

    But since it's not 1998 any more, and an ssd access read starts to approach a memory read in certain usage scenarios, then.. there's just no point for a local system. ..Arguably, having swap on systems that don't cache from slow media (to a swap placed on faster media), is complete idiocy in the first place.

    (And like I said, the way cache-misses is used to get program launch "boosts" on WinMo and Windows and so on is hairy as heck - if you don't already assume that the resources are all there, the program will fail, right - but the files are invalidated as cache misses if the actual file was actually updated.. ..sorry, ranting again..).
     
  18. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
    ^ Windows Mobile? Good times. :p
     
  19. nipsen

    nipsen Notebook Ditty

    Reputations:
    694
    Messages:
    1,686
    Likes Received:
    131
    Trophy Points:
    81
    You're so mean, Groceries :D