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

Thread: Linus Torvalds says a swap file is slower and more problematic than a swap partition

  1. #1
    Join Date
    May 2008
    Location
    United Kingdom
    Beans
    4,717
    Distro
    Lubuntu 18.04 Bionic Beaver

    Question Linus Torvalds says a swap file is slower and more problematic than a swap partition

    According to recent news, Linus Torvalds warns against using a swap file, saying that you should use swap partition instead.
    And, as far as I know, all the normal distributions set things up with swap partitions, not files, because honestly, swapfiles tend to be slower and have various other complexity issues.
    He says that a swap file not only is slower, but also has the potential to cause problems.

    Does this mean that Ubuntu's policy of using a swap file instead of a swap partition is a mistake? Would it be a good idea for me to remove my swap file and replace it with a swap partition? Or is it a bit of scaremongering?

  2. #2
    Join Date
    Aug 2006
    Beans
    13,157
    Distro
    Ubuntu Mate 20.04 Focal Fossa

    Re: Linus Torvalds says a swap file is slower and more problematic than a swap partit

    It's an opinion expressed from his standpoint. Obviously, there are arguments for and against both.
    Here are some answers and opinions:
    https://askubuntu.com/questions/9043...n-vs-swap-file
    https://serverfault.com/questions/25...or-performance

  3. #3
    Join Date
    Jun 2019
    Location
    Dirndl-land
    Beans
    709
    Distro
    Lubuntu 20.04 Focal Fossa

    Re: Linus Torvalds says a swap file is slower and more problematic than a swap partit

    Whether it's faster or not I can't say, but if you need Hibernate (I do, I only use laptops), you'll need to keep the swap partition.

  4. #4
    Join Date
    Mar 2011
    Beans
    1,687

    Re: Linus Torvalds says a swap file is slower and more problematic than a swap partit

    Kernel 5.12 rc1 was recalled because of potential swap-file mismanagement overwriting the root. ;^(

  5. #5
    Join Date
    Mar 2011
    Location
    19th Hole
    Beans
    Hidden!
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Linus Torvalds says a swap file is slower and more problematic than a swap partit

    I tend to give Linus' opinions more weight than most.

    Even before his comments, I've never trusted swap files. I always have mine on its own separate partition. It's not a matter of performance; I don't like having a swap file mucking about on the same partition as my root. It just doesn't feel right/secure.

  6. #6
    Join Date
    Apr 2008
    Beans
    11,705

    Re: Linus Torvalds says a swap file is slower and more problematic than a swap partit

    I can attest to a swap partition providing "more speed" on low RAM systems that use a SSD. I maintain several Latitude 2110's that max out at 2GB RAM and they're frustratingly slow even with a swap partition on a standard hard drive but with a SSD and a swap partition they're considerably less frustrating. Just to satisfy my own curiosity I tried a fresh install of 20.04 running GNOME Flashback w/metacity letting the installer do it's thing with the SSD, which of course creates a swap file, and I was back to frustratingly slow so I went back to using a separate swap partition and the improvement was very noticeable. I think on anything with 4GB or more of RAM the difference would be negligible.

    Please don't rush out and buy one of these old netbooks though! No matter what they're a real kludge and the money is much better spent on a slightly more powerful 12" to 14" laptop of the same vintage!

  7. #7
    Join Date
    Jul 2019
    Location
    Beauvais France
    Beans
    129
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Linus Torvalds says a swap file is slower and more problematic than a swap partit

    A swap partition has the great advantage that it can be shared among several Linux installations.
    Even some Live USB dongle or DVD are clever enough to use it.
    It is also a good idea to locate it at the end of a Windows C: partition so that when W10
    complains that there is not enough room for updating you destroy it and extend the C: one.
    Happy user of Ubuntu-20.04 on a Beelink BT3pro mini PC

  8. #8
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Linus Torvalds says a swap file is slower and more problematic than a swap partit

    I'm firmly in the swap partition/LV group.
    Distros haven't used swapfiles very long and there are clearly failure modes that exist.
    Unix has decades of using swap partitions. The solutuion has been well proven.

    New is the enemy of stable. Every generation has to re-re-relearn this fact.
    Last edited by TheFu; March 8th, 2021 at 03:26 PM. Reason: very --> Every

  9. #9
    Join Date
    Jun 2007
    Location
    Hikkaduwa, Sri Lanka
    Beans
    3,360
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Linus Torvalds says a swap file is slower and more problematic than a swap partit

    Quote Originally Posted by ml9104 View Post
    Whether it's faster or not I can't say, but if you need Hibernate (I do, I only use laptops), you'll need to keep the swap partition.
    Hibernation works with Swapfiles but you need to provide a resume_offset. See:
    https://askubuntu.com/questions/1247...247151#1247151

    A Full install USB drive with a swap partition will also try to use the computers swap partition which can confuse things if the computer is in hibernation.

  10. #10
    Join Date
    Mar 2011
    Location
    19th Hole
    Beans
    Hidden!
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Linus Torvalds says a swap file is slower and more problematic than a swap partit

    Quote Originally Posted by C.S.Cameron View Post
    …A Full install USB drive with a swap partition will also try to use the computers swap partition which can confuse things if the computer is in hibernation.
    Hibernation is a risky function at the best of times. Pros who know what they are doing can usually spot its pitfalls, but so many newbies have been burned that I recommend against it on general principles.

Page 1 of 2 12 LastLast

Tags for this Thread

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
  •