LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Can I install linux without a swap partition? (https://www.linuxquestions.org/questions/linux-general-1/can-i-install-linux-without-a-swap-partition-82969/)

jbeedham 08-17-2003 09:38 PM

Can I install linux without a swap partition?
 
Ok, I got 2 partitions on my hard drive dedicated to my Mandrake 9.0. I wanted to upgrade to 9.1 and was curious if I could get rid of the swap partition so I could dedicate more space to my files.

leonscape 08-17-2003 09:41 PM

Short answer, No. Its also a very bad Idea.

But you can reduce it in size. try half your RAM. It shouldn't be much bigger anyway.

DrOzz 08-17-2003 09:43 PM

well i would recommend at least leaving a small swap size....maybe just reduce it to 64megs or so...

2damncommon 08-17-2003 10:01 PM

You can set up a swap file instead. It will be slower.

dd if=/dev/zero of=/swap bs=1024 count=65664
to create a file called swap that is about 64MB.

mkswap /swap 65664
swapon /swap
to activate it.

jbeedham 08-17-2003 10:04 PM

I think I will just tinker with the size of it instead of getting rid of it completely. I think I got 500 megs dedicated to it know so if I drop it down to like 128 or 64 that will save me a lot of space.

blaisepascal 08-17-2003 11:42 PM

Quote:

Originally posted by leonscape
Short answer, No. Its also a very bad Idea.
Does Mandrake require a swap on installation/upgrade, just out of curiosity? When I installed RedHat 9 without a swap partition, I got a warning box. I quickly clicked the wrong button (I was going to correct the partitions but didn't, so no swap), but the install proceeded normally. In fact, everything's seems to be working; now, whether the system is slower or faster with no swap partition or swap file, I don't know.


BP

0012

leonscape 08-17-2003 11:55 PM

You can get away with no swap and use a file, but its just not worth the effort.

Its one of the reasons I hate windows is the horrible page file. Page files are a lot slower than a partition.

A dedicated swap doesn't mess with your files, and you can put on the outside of your disk to make it even faster. :)

You always need some sort of swap (just in case you run out of memory) file or partition. Partition is a good solution (the best at the moment).

slakmagik 08-18-2003 12:15 AM

In the days of yore, you needed swap because disk storage was cheaper than physical memory (still is, but both are far cheaper - physical memory is a hell of a lot cheaper now than disk storage was then). Now, some programs may expect it, possibly, and malfunction without it but that would be bizarre. Nothing should really *need* swap unless you run *out* of physical memory. If you've got 512 MB and constantly run at 300 MB usage, you don't need it. On the other hand, if you get a surge, like you're compiling a kernel and downloading an iso and watching a DVD and 20 other things and one of those apps goes a little haywire and spikes it when your running near the edge, you're going to wish you had some swap as a safety buffer. Or if you have gigs of memory, I can't conceive *ever* needing swap. Whereas if you're trying to run X on 16 MB, you've pretty much *got* to have swap. It all depends on your hardware and your usage. I think it's a good idea to have some just so that if you ever notice you're using it (beyond the few megs Linux sometimes decides to take advantage of in advance) it gives you a clear sign to cut back. But I'm not surprised there are people like you, blaisepascal, running fine without it. And I don't believe you're running any slower.

All swap does is change 'running fast -> locking up' to 'running fast -> running slow -> locking up'. It's a safety buffer of slow running before locking.

Or so I theorize. :D

ChristopherJ 07-26-2010 04:50 AM

I have installed "GKRellM" so that I can see how much memory is in use. And out of the 2 Gb I am using about 1/4 and NO swap.

Will this be ok to preceed? I have Ubuntu installed on a 4 Gb USB drive.

Christopher

pixellany 07-26-2010 05:04 AM

"If it works, it's OK."

Normally, with a large hard drive, there is NO reason not to have SWAP---With your 4GB USB (thumb drive, I assume), it's obviously different.

By the way, it is normally better not to exhume old threads like this---no problem in this case.

jefro 07-26-2010 04:04 PM

Older systems needed swap files. Not sure one needs it on a home based system with newer hardware.

beowulfnode 11-14-2010 06:56 PM

you do not want to put a swap drive on a flash memory device that is not an SSD HDD, as most of the USB memory sticks do not have decent wear leveling firmware built in (see http://en.wikipedia.org/wiki/Wear_leveling ).

For my test nas with zfs-fuse, system it has
- 1GB usb stick system drive
- 2GB ram
- ubuntu server 10.10 minimum install (no gui) + samba + zfs-fuse + ssh
In fact for added life on the usb stick, I'm going to be making a RAM disk for storing temporary info such as logs to minimise the number of write operations to the usb stick.

Edit: yes you can install with no swap space.
Some situations are better without swap, such as my case, and some are better with swap.

theKbStockpiler 11-14-2010 10:25 PM

Swap partition of One gig is plenty.
 
Unless you are gaming one gig of RAM should be plenty and up to one gig of swap is plenty. One gig is not much as far as hard drive space is concerned. If this small amount is critical maybe you can compress files or remove some. I messed up my swap space on a install once and had a swap partition of one kilobyte. I had two gigs of ram and it worked fine.

catkin 11-14-2010 10:59 PM

The simple answer is that you need swap space if you need swap space and the only way to find out if you do is by monitoring whether it is used for which GKrellM is helpful (you can set it always on top of other windows) or you can run something like the free command in an infinite delayed loop writing to a log file. There have been some reports that systems run faster without swap ... but I don't recall any hard measurements to prove it.

EDIT: it all depends on the actual memory usage patterns so rules of thumb like "swap should be whatever times real memory" and "more than 4 GB of memory and you don't need swap" are useless.

hughetorrance 11-15-2010 07:21 AM

Can I install linux without a swap partition? Yes !


All times are GMT -5. The time now is 11:35 AM.