Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: swap partition on SSD a bad idea?

  1. #1
    Join Date
    Aug 2006
    Beans
    417
    Distro
    Ubuntu 13.04 Raring Ringtail

    swap partition on SSD a bad idea?

    I just upgraded to an SSD (obviously a HUGE speed increase) and now I'm tweaking it to make sure it stays fast.

    I'm used to putting the swap partition on the same drive as the root partition. However I came across this:

    http://ubuntuforums.org/showpost.php...11&postcount=8

    Quote Originally Posted by dcstar
    The bottom-line seems to be that all of your partitions on a Linux SSD should be EXTx (or whatever else supports TRIM in Linux) otherwise you could virtually have a no-TRIM drive after some time.
    I enabled TRIM on the ext4 root partition. There's no way to enable TRIM (the "discard" mount option) on the swap partition as swap partition types don't support it.

    Should I move the swap partition off the SSD?

    Thanks.

  2. #2
    Join Date
    Dec 2007
    Location
    Idaho
    Beans
    4,976
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: swap partition on SSD a bad idea?

    Perhaps you could use a swap file as a sort of workaround
    "You can't expect to hold supreme executive power just because some watery tart lobbed a sword at you"

    "Don't let your mind wander -- it's too little to be let out alone."

  3. #3
    Join Date
    Apr 2008
    Location
    LOCATION=/dev/random
    Beans
    5,767
    Distro
    Ubuntu Development Release

    Re: swap partition on SSD a bad idea?

    I have my swap on my 1TB hard drive instead of my SSD.

    I could actually do without as my system never swaps (8GB RAM), I just have it for the rare occasion I want to hibernate.
    Cheesemill

  4. #4
    Join Date
    Jul 2005
    Location
    Hughenden, Australia
    Beans
    5,100
    Distro
    Ubuntu Mate 20.04 Focal Fossa

    Re: swap partition on SSD a bad idea?

    I use a small program called Dynamic Swap Space Manager,( 'swapspace' for short).
    Swap is not needed for system performance as much now as it used to be just a few short years ago when the PCs most of us could afford were underpowered and memory modules were very expensive. Now most computers have adequate RAM.
    Nevertheless, the operating system seems laggy if there's no swap area at all.
    Dynamic swap manager creates small swap files automatically on demand. It saves a lot of otherwise wasted disk space compared with using an oversized swap area which is mostly not going to be used. I imagine it should give another layer of randomization for any wear on top of the wear leveling we would already have built in to the flash memory too. I have not been able to notice any difference in system performance.
    A downside is I don't think we can use hibernation with swap Space Manager, or it didn't seem to work for me the last time I tried.
    Code:
    sudo apt-get install swapspace
    Then in addition to that I like to adjust swappiness to 10, That tunes the operating system to prefer to us all the RAM first and to only use the swap files as a last resort. Since RAM is much faster than swap, the added benefit is a small improvement in operating system performance, (your mileage may vary depending on hardware details). Swap FAQ - Ubuntu Community Docs]
    Linux Performance tuning - vm.swappiness - unixfoo.blogspot.com
    What Is the Linux Kernel Parameter vm.swappiness? - Linux Open Source Blog
    Code:
    gksudo gedit /etc/sysctl.conf
    Append this line to the bottom of the file,
    Code:
    vm.swappiness=10
    The end result is a lean, fast system that can create swap files on demand but hardly ever needs to.
    Last edited by Herman; March 8th, 2012 at 11:45 AM.

  5. #5
    Join Date
    Jan 2008
    Beans
    7,744

    Re: swap partition on SSD a bad idea?

    If you use swap rarely, then it is a non-issue.

    If you use swap frequently, then theoretically, you are putting more wear and tear on the SSD. In that case you would benefit from a RAM upgrade or adjustment to your swappiness setting.

    https://help.ubuntu.com/community/SwapFaq

    It's worth noting that--all else being equal--modern, high-quality SSD's will probably last longer than a comparable HDD due to the lack of moving parts. (Especially if it is a laptop/netbook.)

  6. #6
    Join Date
    Jul 2005
    Location
    Hughenden, Australia
    Beans
    5,100
    Distro
    Ubuntu Mate 20.04 Focal Fossa

    Re: swap partition on SSD a bad idea?

    Hey I'm not on the payroll of any particular hardware manufacturer, nor do I receive any money for advertising hardware products. I'll just say this: The brand of SSD I buy features built in wear leveling of the flash and has had native TRIM for a couple of years now at least, and has a lifetime guarantee.
    http://ubuntuforums.org/showpost.php...11&postcount=8
    Originally Posted by dcstar
    The bottom-line seems to be that all of your partitions on a Linux SSD should be EXTx (or whatever else supports TRIM in Linux) otherwise you could virtually have a no-TRIM drive after some time.


  7. #7
    Join Date
    Aug 2006
    Beans
    417
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: swap partition on SSD a bad idea?

    Thanks for all the replies everyone!

    Quote Originally Posted by Herman View Post
    I use a small program called Dynamic Swap Space Manager,( 'swapspace' for short).
    Swap is not needed for system performance as much now as it used to be just a few short years ago when the PCs most of us could afford were underpowered and memory modules were very expensive. Now most computers have adequate RAM.
    Nevertheless, the operating system seems laggy if there's no swap area at all.
    Dynamic swap manager creates small swap files automatically on demand. It saves a lot of otherwise wasted disk space compared with using an oversized swap area which is mostly not going to be used. I imagine it should give another layer of randomization for any wear on top of the wear leveling we would already have built in to the flash memory too. I have not been able to notice any difference in system performance.
    A downside is I don't think we can use hibernation with swap Space Manager, or it didn't seem to work for me the last time I tried.
    Code:
    sudo apt-get install swapspace
    Then in addition to that I like to adjust swappiness to 0, That tunes the operating system to prefer to us all the RAM first and to only use the swap files as a last resort. Since RAM is much faster than swap, the added benefit is a small improvement in operating system performance, (your mileage may vary depending on hardware details). Swap FAQ - Ubuntu Community Docs]
    Linux Performance tuning - vm.swappiness - unixfoo.blogspot.com
    What Is the Linux Kernel Parameter vm.swappiness? - Linux Open Source Blog
    Code:
    gksudo gedit /etc/sysctl.conf
    Append this line to the bottom of the file,
    Code:
    vm.swappiness=10
    The end result is a lean, fast system that can create swap files on demand but hardly ever needs to.
    Wow, this is great!

    I've carried out both suggestions. I hardly ever use swap and when my system does it's puzzling because there's usually a few hundred MB of RAM free. I'd much rather have a program generate a swap file dynamically on demand. Also the swappiness setting should avoid those rare times I'm using swap and it doesn't look like I really should be.

    Should I get rid of my existing swap partition? Is it as simple as removing the entry in fstab, deleting the partition and merging the empty space into the other partition?

  8. #8
    Join Date
    Apr 2008
    Location
    LOCATION=/dev/random
    Beans
    5,767
    Distro
    Ubuntu Development Release

    Re: swap partition on SSD a bad idea?

    Quote Originally Posted by Fraoch View Post
    Is it as simple as removing the entry in fstab, deleting the partition and merging the empty space into the other partition?
    Yep. That will do it.
    Cheesemill

  9. #9
    Join Date
    Aug 2006
    Beans
    417
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: swap partition on SSD a bad idea?

    Quote Originally Posted by Herman View Post
    Hey I'm not on the payroll of any particular hardware manufacturer, nor do I receive any money for advertising hardware products. I'll just say this: The brand of SSD I buy features built in wear leveling of the flash and has had native TRIM for a couple of years now at least, and has a lifetime guarantee.
    While I'm very pleased with the speed of my new Crucial M4, it looks very much like it desperately needs TRIM:

    http://www.anandtech.com/show/4253/t...0-ssd-review/2

    It's simple enough to do, just enter "discard" into the fstab mount options. For kicks I also used "noatime" here to reduce writes. I was thinking of making a tiny HOWTO for this but it's so trivial I'd feel silly.

  10. #10
    Join Date
    Aug 2006
    Beans
    417
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: swap partition on SSD a bad idea?

    Quote Originally Posted by Cheesemill View Post
    Yep. That will do it.
    Thanks!

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

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