Linux For Your Life

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Thursday, 1 October 2009

Add a swap file or expand existing swap space

Posted on 05:25 by Unknown
        It’s a myth to say that Ubuntu (or any Linux) needs a swap partition.This is certainly the preferred way of working, and is most efficient,but Linux can also use a single swap file located in the root partition,just like Windows or Mac OS X. There are times when this is advantageous,such as if you’re only able to create one partition for Ubuntu (for example, Apple’s BootCamp software only allows the creation of a single non-Mac partition when dual-booting).

        To create a swap file, you need to first create a dummy file of sufficient size, then format it as a swap file, and finally ensure that Ubuntu uses it at boot-up. The following steps do just that (be extremely careful entering these commands):

1. Open a terminal window and create an empty file in the root of the file system using the dd command, as follows (this creates a 1GB file—you should ideally adjust the count= figure to at least match the size of your memory, bearing in mind that there is 1,024MB in a 1GB):

$ sudo dd if=/dev/zero of=/swapfile bs=1M count=1024

2. Now we need to format it as a swap file:

$ sudo mkswap /swapfile

3. The final step is to make Ubuntu mount it at boot, which is done by editing /etc/fstab:

$ gksu gedit /etc/fstab

Then make a new line at the bottom of the file and add the following:

/swapfile none swap sw 0 0

You can align the entries on the line under the column headings in fstab, like the other entries in the file, but it doesn’t matter so long as there is at least one space between each entry on the line. Once done, save the file and reboot your computer. 
 

Once the computer has rebooted, you can test to see if the swapfile is being utilized by typing cat /proc/meminfo|grep Swap. 

The steps above can also be used to add more swap space to a system that has an existing swap partition. You might want to do this if you’re editing extremely high-resolution photographs, for example, or working with large video files.

Reference : Ubuntu Kungfu Linux


Thanks
By:Mr.Gm
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in Optimize Linux system | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

Categories

  • Applications
  • cairo-dock
  • convert Rpm to Deb
  • Desktop
  • Distro
  • Download Manager
  • Fix Crash GUI
  • Format USB
  • game
  • hardware
  • Install Linux
  • internet and Web
  • Linux Intro
  • LiveUSB
  • Local Repository
  • nautilus
  • Optimize Linux system
  • Programming Language
  • Robot
  • Server
  • so
  • Terminal
  • Tips and Trick OpenOffice
  • Tugas Manajemen Proyek dan Risiko
  • Tugas SoftSkill
  • wifi

Blog Archive

  • ►  2012 (5)
    • ►  June (2)
    • ►  May (1)
    • ►  April (1)
    • ►  March (1)
  • ►  2011 (29)
    • ►  December (10)
    • ►  November (2)
    • ►  October (2)
    • ►  May (11)
    • ►  March (2)
    • ►  February (2)
  • ►  2010 (74)
    • ►  December (13)
    • ►  October (4)
    • ►  June (12)
    • ►  May (10)
    • ►  April (6)
    • ►  March (8)
    • ►  February (18)
    • ►  January (3)
  • ▼  2009 (42)
    • ▼  October (6)
      • How To Running C Language on Linux
      • Fedora 11
      • Changing OpenOffice Splash Screen Images
      • sitemap
      • Switch to Kubuntu, Xubuntu, or Edubuntu
      • Add a swap file or expand existing swap space
    • ►  September (13)
    • ►  August (13)
    • ►  July (10)
Powered by Blogger.

About Me

Unknown
View my complete profile