Swap files vs. swap partitions

Posted by Chris Ball Mon, 27 Mar 2006 17:55:00 GMT

It took far too long to find this half-remembered linux-kernel thread on Google amidst all the results (mostly from distro installer guides) claiming that swap partitions are preferable to swap files. Here's hoping the link below will help future searchers.

Swap files and swap partitions have the same performance:

In 2.6 [swap files and swap partitions] have the same reliability and they will have the same performance unless the swapfile is badly fragmented.
-- Andrew Morton, on linux-kernel.

(There is a performance difference under Linux 2.4, though, as explained at the link above.)

Update: Tim comments that swsusp (the kernel software suspend-to-disk support) only works with swap partitions, so there is still one good reason to use a swap partition. Suspend2 doesn't have this limitation.

Tags ,  | 11 comments | no trackbacks

Comments

  1. Avatar Julian Turner said about 2 hours later:
    The swap partiotion still has one advantage: You can easily use one for several Linux installations if you dual-boot.
  2. Avatar Tim said about 2 hours later:
    According to this, the kernel's suspend code (CONFIG_SOFTWARE_SUSPEND) doesn't play nice with swap files -- you need a swap partition for it. I agree that swap files are better in 99% of cases these days. But I also want to power down my computer without closing all my work. (The ideal solution, of course, is a kickin' suspend feature for Linux that can work with a swap file, but that doesn't appear to be a priority for the kernel guys.)
  3. Avatar Chris said about 3 hours later:
    Thanks, Tim; I didn't know that, and I've added an update to the post.
  4. Avatar Chris said about 6 hours later:
    Splutter. I decided to see if porting swapfile support from suspend2 was plausible, and found this (unrelated) snippet in Documentation/power/swsusp.txt as advice for how to get your page cache sane after a resume:

    cat `cat /proc/[0-9]*/maps | grep / | sed 's:.* /:/:' | sort -u` > /dev/null

  5. Avatar online pharmacy said 7 months later:

    Hello this is nice site more information in this archives. Thanks!

  6. Avatar online pharmacy said 7 months later:

    Hello! This is nice information site. Thank you.

  7. Avatar phentermine 37.5 mg said 7 months later:

    Hello! This is nice information site. Thank you.

  8. Avatar cheap hydrocodone said 8 months later:

    Hello this is best online news archive . Thank you!

  9. Avatar aka said 9 months later:

    collant chat troie in ticino segretarie sey amatoriale scopa nylon ￿￿￿￿￿￿

  10. Avatar aka said 9 months later:

    collant chat troie in ticino

  11. Avatar craigslist news blog said about 1 year later:

    I searched a long time for such an great article. Thank you very much. You have to be patient with such material if you're really interested in extracting some info off.

Trackbacks

Use the following link to trackback from your own site:
http://blog.printf.net/articles/trackback/17

(leave url/email »)

   Comment Markup Help Preview comment