Techie:Techie Main/Linux/Increasing Swap Space

From FFL Wiki
Revision as of 09:07, 27 May 2010 by Phallus (talk | contribs) (Created page with '== Increasing swap partition size == Preferable if that's an option but not detailed here == Adding an extra swap file == There is [http://www.linux.com/archive/feature/113956 …')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Increasing swap partition size

Preferable if that's an option but not detailed here

Adding an extra swap file

There is [http://www.linux.com/archive/feature/113956

| a good article on linux.com] about this.

It boils down to

  • Check existing swap space
    • /sbin/swapon -s
  • Decide where to put swap file (assume /extraswap for this example)
    • df -m
  • Backup important data just in case
  • Swap to root user
    • sudo su -
  • Create file initially full of zeros
    • dd if=/dev/zero of=/extraswap bs=1M count=512
  • Prepare file as a swap file
    • mkswap /extraswap
  • Turn on our swap file
    • swapon /extraswap
  • Check it's ok
    • /sbin/swapon -s
      • should include /extraswap in list
    • free
      • should show expected increase in swap space
  • add /extraswap to /etc/fstab so that it's still there when we reboot
    • cp /etc/fstab /etc/fstab.mybackup
    • add following line to /etc/fstab underneath existing swap entries
      • /extraswap none swap sw 0 0