LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Creating a swap partition (https://www.linuxquestions.org/questions/linux-newbie-8/creating-a-swap-partition-107856/)

thejackal13 10-23-2003 10:45 PM

Creating a swap partition
 
Can someone please explain to me about the swap partition. I don't beleive I have one. How can I check to see if I do, and if I don't and i should use one, how do i create one? Does it speed up linux if i do have one?

misophist 10-23-2003 11:13 PM

Open a console and enter 'cat /etc/fstab' (sans quotes). This shows your mountable partitions. Swap is called swap and is mounted on swap with a swap file system. There should be something like this on almost any distro. I can't believe an installer would let you forget a swap partition. If you have plenty of RAM it shouldn't really matter but the people with the experience and know-how say we need one. Twice the amount of RAM is the normal size.

If you don't have one, a reinstall could be the easiest way to get one.

tokyoeye 10-24-2003 08:50 AM

To see whether you have a swap partition mounted type 'cat /proc/swap' and read the output.

To create a swap partition you can use this command:
mkswap /dev/hda2

to activite the swap partition use:
swapon /dev/hda2


Note that on your system it's probably not hda2.

Hope this helps...

michaelk 10-24-2003 12:36 PM

Swap is the same thing as virtual memory on windows OS. In a nut shell ( in reality its a little more complicated ) if you run out of physical ram, non active applications and data will be exchanged between RAM and the hard drive.

I think having a swap partition is a good idea. The 2x rule IMHO is outdated with lots of RAM. A 512 partition is a good size.

The console command free will tell you if swap is active. If total swap size is a non zero value its working.

Using swap space is slower since your using the hard drive. And in most cases unless your PC is a hard core web, mail and or database server it probably will use little or no space at all. If you need swap and do not have your machine will really slow down and it might crash.

misophist 10-24-2003 01:57 PM

Since 'cat /proc/swap' won't work on my machine and 'free' may not work on yours (although it should), yet another method is ' ps -A | grep swap' which will show if the swap daemon is running.

thejackal13 10-28-2003 09:00 AM

thank you for all your help guys. Sorry I haven't replied earlier but i have been super busy with school work and stuff. But i am gonna use what was written here and take a look at it. Thanks.

thejackal13 10-30-2003 07:03 PM

Thanks tokyoeye, i did what you said i am pretty sure it worked, thanks a bunch man!!


All times are GMT -5. The time now is 12:50 PM.