Can I get away with running Ubuntu without a swap partition?

Soldato
Joined
4 Jan 2004
Posts
20,802
Location
¯\_(ツ)_/¯
As I can only have 4 partitions on my drive, and I've already got 3 other partitions excluding the HFS Ubuntu partition.

I'm running a 1.6GHz Atom with 1.5GB of ram... So not exactly a screamer!

The Installer said it was 'not recommended'... Exactly how important is a swap partition?
 
Consider it the same as running windows without virtual memory. If you're planning on going without a swap then go for an uber light linux build, 1.5gb of ram will fill fast.
 
Thanks, I think it should be ok. I'm not planing on doing too much heavy multitasking, and I'll try and disable unneeded services and various things like that.

If I do run out of RAM, will I get a warning message about it or will things crash and go horribly wrong... Or has anyone yet to do this?
 
I ran a Gentoo system with 1gb memory and maybe 320mb swap, swap was almost never used except when playing ut2004

In my experience swap was hardly ever used on my old system, but you should consider monitoring memory usage and make your own observations as mileage may vary according to applications.
 
I run ubuntu without swap no probs, but I have do have 6GB RAM.

Ubuntu supposedly needs 256MB to run and the default swap last time I used it was 1.5GB so if you run without swap you are not far off what the minumum spec PC would be on default install. I expect you'll be fine.
 
Thanks all, I'm running it right now with no swap and all seems good.

I don't really do any gaming under Linux, I boot into Windows for that.

I mainly just do browsing and some casual coding under Ubuntu, so nothing too RAM intensive. :)
 
I'm sure I'm missing something obvious, but why not make a swap file instead? Performance is identical to a swap partition as of some kernel number from ages ago.

As root,
Code:
dd if=/dev/zero of=/mnt/512.swap bs=1M count=512 #makes a 512Mb swapfile on /mnt.
mkswap /mnt/512Mb.swap
swapon /mnt/512Mb.swap

Needs an entry in fstab to mount it automatically of course, but that's all you need to do. Change 512 to whatever you feel like obviously. fstab entry of
Code:
/mnt/512.swap  none  swap  sw  0 0
is sufficient. Safer than running with no swap file at all.

edit: you could reformat, putting ubuntu and swap on a logical partition rather than a primary one instead if you wanted. Lot of hassle for no obvious gain.
 
Just pass the warning, it will work.

But consider this:
When programs in windows ask for memory they don't use, it is reserved, usually in the page file. If there is no memory available, that program will crash.

When programs in Linux ask for memory they don't use, they are ignored, and they only ever get what they actually use.

This means linux can run more programs in the same memory, but when there's no memory available, it gets difficult, since all the programs think they have enough memory. It has a scoring system which decides what program to kill 1st. It's pretty random, and never seems to kill the program eating all the memory (Firefox usually). Instead it seems to go for something that auto-respawns and you end up with a locked up system in a loop trying to kill something that keeps coming back. With a swap partition this doesn't happen.
 
I'm sure I'm missing something obvious, but why not make a swap file instead?
I had no idea you could use a swap file. I always assumed Linux needed a dedicated swap partition. But I admit I have not had much experience with Linux.

I'll give a swapfile a go. I'm not short of HD space, only partitions as you are limited to 4 partitions with an MBR style partition system. :)
Just pass the warning, it will work.
Thanks for the heads up, I have noticed FF can be a little memory hungry at times. I'm going to give the swap file thingy a go I think. :)
 
Ah, all is good then. Swap files really are that easy. It's good being able to swapoff, change the size of the file, swapon without messing with partitions too.

You're limited to four physical partitions, but you can have mad numbers of logical ones. Windows is not happy booting from a logical partition but linux couldn't care less, I'm using one of my four allowed partitions for debian, split into three logical ones for /, swap, /home.
 
Back
Top Bottom