1

My computer has more than 64KB of RAM (8GB), if I run out of memory I want things to crash so I know I'm out of RAM so I'll buy some instead of say wandering why my computer is running slowly when I can just spend another $40 for another 8GB of RAM.

I'm running Kubuntu in VirtualBox. I'm not sure if there is any way to permanently disable the swap file after the installation has finished.

As with previous Linux installs I've found that the newer GUI installers do NOT provide an option to have a single partition without a swap forcing me to use the old DOS/Console styled installers which do. If I have to reinstall from scratch (not a huge ordeal for me) are there multiple installers or does the regular Kubuntu installer provide a manner to install without a swap file?

  • I'm absolutely sure I want to do this, I have not run a pagefile in years in both XP and other Linux distros I've tried and enjoy my systems being responsive.

  • I'm semi-capable in the console though please do not ask me to type a hundred lines to do a simple copy/paste or text edit, I'm interested in Linux for production not a hobby.

  • I'll be happy to both accept and up-vote whatever answer works as well as clarify anything.

John
  • 208
  • FWIW, the installer will let you go ahead without swap if you do the partitioning manually and just don't have any partitions of type swap. (It'll warn, but you can continue.) – Ulrich Schwarz Jun 27 '12 at 20:08
  • Thanks, I'm awaiting a minor answer to figure out how to save an edited text file because of root permissions before I can accept or up-vote. Simple stuff to veterans... – John Jun 27 '12 at 20:09
  • Having a page file doesn't slow your system down, your basic premise is mistaken. – EightBitTony Jun 27 '12 at 20:24
  • A pagefile is a second copy of files on the hard drive, the files already exist therefore the hard drive (slowest between HD/RAM/CPU) is wasting time making the user wait to make a copy of a file. It's an irrelevant remnant from the 70s/80s when RAM was expensive. My computer should only do what I tell it to do, if I run out of RAM then I want to know so I will buy more. If it's something that I'm no longer using I'll close the application manually. – John Jun 27 '12 at 20:38
  • 1
    A page file (or swap area) is not a second copy of files on disk. You seem to misunderstand what virtual memory is about and how it is handled. In any case, I would advise monitoring swap usage instead of waiting for processes to crash. – jlliagre Jun 27 '12 at 22:02
  • There is a misconception here: disabling swap will make your system slower, not faster. The reason is that you will have less memory available for the disk cache (about 50% of the RAM on a healthy system). – Gilles 'SO- stop being evil' Jun 27 '12 at 23:30
  • Regarding the "no option for configuring no swap" is not quite accurate. The way to do that during the install is when it gets to the screen asking how you want to install (replace, install alongside, blah, blah) you want to choose the "something else" (usually with a gear on it), but then you are responsible for configuring your partitions exactly how you want them and what filesystems, and making sure you at least have a partition flagged to be "/". – killermist Jun 28 '12 at 01:46
  • @lornix, sent you a reply though your site. – John Jun 30 '12 at 09:48
  • {Grin} good... now send another with your email address in it... can't reply! – lornix Jun 30 '12 at 10:25
  • @lornix I did use my email on your contact form, my site's private message system is threaded, the site should send you a numeric password associated with your email address to sign in as a guest to continue replying to the existing thread. If it didn't let me know here so I can fix it. – John Jun 30 '12 at 10:55

4 Answers4

5

Just like every other distro.

swapoff -a

Then edit /etc/fstab and remove references to swap.

bahamat
  • 39,666
  • 4
  • 75
  • 104
  • Console says I'm not a super user even after using sudo. – John Jun 27 '12 at 19:10
  • sudo works with one command at a time (slight oversimplification). First you say sudo swapoff -a, then you say sudo $EDITOR /etc/fstab, or maybe sudoedit /etc/fstab. If you don't like vi, set your preferred editor with EDITOR=/usr/bin/whatever before you edit /etc/fstab. – Alexios Jun 27 '12 at 19:21
  • sudoedit /etc/fstab worked, was able to comment out the last line however how do I save? Obviously a keyboard combination and I haven't seen this type of console editor for years. – John Jun 27 '12 at 19:28
  • @John - so what is your editor? Escape, then :wq will do the job on vi. – Nils Jun 27 '12 at 20:55
  • Kubuntu opens up GNU nano. I looked up their FAQ and I might as well had been reading a manual for how to put together a partial accelerator. >__> – John Jun 28 '12 at 00:40
  • For nano the quit/exit command is ctrl-x. If you made any changes, it'll ask you if you want to save changes or not or allow you to use ctrl-c to abort exiting. Instances of nano I use generally have a 2-line list of shortcuts/controls at the bottom of the screen. That seems kind of standard in all the distros/installs I've done. – killermist Jun 28 '12 at 01:37
  • Thanks however it keeps trying to save as a temporary file and then when I change it to the path of the original file it acts like it was successful and then opening the file in a normal editor I see no changes were made. >__> – John Jun 28 '12 at 03:24
  • @John That's how suodedit is supposed to work - it runs your editor as non-root on a temporary copy of the file. Just save using the temporary file name it gives you. After you quit the editor, sudo will detect that the file was changed and copy those changes over the original file. This way you are not running an editor as root. – jw013 Jul 05 '12 at 04:33
4

This isn't an answer; I wanted to comment but my non-answer-type-thing wouldn't quite fit in the comment box, so here it is. Feel free to ignore/downvote — and yes, I know you're sure you don't want swap.

POSIX/Linux Swap isn't like Windows pagefiles, and Linux overcommits memory. That means that you may have 8 gigs of RAM, and the OS will happily allocate you 64 GB if you like it (and are running on a 64-bit architecture). Everything will be fine and dandy until you fill up one to many pages of that block of ‘memory’ and the Linux OOM Killer wakes up.

The OOM Killer is like the Kraken. When it wakes up, it's going to have a sacrificial process for lunch, and there's nothing you can do to stop it. There's also nothing you can do to influence the choice of process. It's usually a big process but not necessarily the culprit. If this process is useful to you, tough. The OOM Killer doesn't care, and Murphy's Law isn't on your side. I've known it to compromise live servers by killing important processes.

Overcommitting is done by design, and the OOM Killer is one way to solve the obvious problem of what happens when some process calls the kernel's ‘64 gigs? Suuure’ bluff. Many people consider it an inconvenient little wart, and we like to keep it sedated as long as possible.

If $40 is an acceptable upgrade price for you, by all means, get another 8 GB of RAM. Add a little bit of swap too, though. Just a few gigs will do. It's not going to compromise the speed of your computer, and you can adjust how much Linux will loathe dipping into the swap. With 8GB of RAM, you might see a few megs in the swap and that's all. Crank it all the way up if you want! Having the swap means that you'll get a little bit of warning before you start losing processes.

As an example, my computer has 4GB of RAM and it's only using 350K of swap.

Besides, if you installed Ubuntu, you already have a swap partition. It's a pity to let the space go to waste.

This has been discussed a lot in various places, including here: is swap an anachronism? It's an interesting read.

Alexios
  • 19,157
2

To disable the swap after the install, you can edit the /etc/fstab file and comment out the line that enables swap.

Jon Lin
  • 479
0

Console commands due to the lack of a GUI option...

1.) Open console.

2.) Type the following command...

sudo swapoff -a

3.) Enter your root password.

4.) Type the following command...

sudo nano /etc/fstab

5.) Comment out the swap line (seems to be the last, will say "swap" on it.

6.) Press CTRL+x to save if using nano and confirm the file by pressing 'y'.

Was told that the caret ^ signifies the CTRL (Control) key. Exiting will prompt the file to be saved.

John
  • 208