Making a swapfile

  1. Multiply the Mb of swap that you want by 1024. For example, a 256 MB swap file would give 262144.
  2. As root or prefacing the commands with sudo, type the following commands where <size> is the number you got from Step 1:
      dd if=/dev/zero of=/swapfile bs=1024 count=<size>
      mkswap /swapfile
      swapon /swapfile
  • The above commands create the file, make the file a swapfile, and then turn it on. You should now see your additional swap using the commands top or free.
  • To enable your swapfile during normal boot, edit /etc/fstab to include:
      /swapfile               swap                    swap    defaults        0 0
/home/www/LinuxBasics.org/data/pages/tutorials/using/making_a_swapfile.txt · Last modified: 2008/07/20 21:08 (external edit)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0