UbuntuThis forum is for the discussion of Ubuntu Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm running Ubuntu 6.06 on a Toshiba Satellite laptop with 256mb (PC133) RAM. I want to increase the RAM to 512 and I have read that it is good to make the swap twice the size of available RAM. How can I do this without reinstalling the OS? I have read similar threads but wasn't sure if those directions would work in Ubuntu so I'm asking it here.
Swap is swap; the distribution doesn't much matter. The easiest way to add swap is to add a second level of swap in a file. For example, to add 512MB of swap (as root):
1. Prepare the swapfile:
Code:
# dd if=/dev/zero of=/swapfile bs=1M count=512
512+0 records in
512+0 records out
536870912 bytes (537 MB) copied, 22.0228 seconds, 24.4 MB/s
2. Format it as swap:
Code:
# mkswap /swapfile
Setting up swapspace version 1, size = 536866 kB
3. Add it to /etc/fstab:
Code:
/swapfile swap swap defaults 0 0
4. Start using it (will happen automatically at boot in the future):
Code:
# swapon /swapfile
You can verify it's now available with:
Code:
# swapon -s
Filename Type Size Used Priority
/dev/hda3 partition 2032212 1648 -1
/swapfile file 524280 0 -2
Thanx! That was very helpful! So, with this setup, if the computer uses up one swap partition it will then automatically dip into the next swap? How much swap do YOU recommend?
Yes, when the primary (partition) is full, it will use the swapfile. This is actually more efficient than a single large area, as it keep seeks short.
There's no "one size fits all" with swap. As your real memory increases, you actually need less. I'd recommend 4x real at 128MB, but decreasing to 1/4 real (256MB) at 1GB. Your usage pattern may be different, but I typically have a dozen or more windows/applications running, and that's fine for me.
That's another nice thing about using a swapfile; you can estimate low and add it if necessary on the fly. You may want to run for a while without increasing your swap after increasing your RAM, and see what your usage is. If you don't need it, don't add it.
The 'swapon -s' will give you a current snapshot. The 'top' command will also provide the swap usage in the header. You can also run one of the many system monitors, like gkrellm, conky, etc. They can display swapping information in near-realtime if you want to keep an eye on it.
If you don't want to install anything Gnome comes with a monitor for the panel... Right-click on an empty area on your panel (usually at the top/bottom of the screen), and select 'Add to Panel'. Scroll down to the 'System Monitor' and click on Add, then close. The monitor will be added to the panel. You can right click on it and select 'Preferences' to add a monitor for swap.
You have replied to a thread which has been inactive for almost ten years.
You are encouraged to open your own thread with a complete description of your problem so that your question will receive better exposure and attract more relevant answers.
Swap is always allocated on a storage device such as a HDD or SSD, either as a partition or a file. It is used to temporarily free blocks of used but inactive RAM for use by higher priority processes.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.