Skip navigation.
Home
Now Shipping Version 8.0

No swap partition?

lessax's picture

Posts: 18

After installing SimplyMphis 6.0 and using the default settings I checked my drive space and found that I do not have a swap partition. I have /dev/sda1/ntfs of 150 GB and /dev/sda2/ext3 of 154 GB. I have 2 GB of memory on the system.
My question is:
Do I need a swap partition with that much memory? (my guess is yes)
Why didn't the install set up a swap partition?
and
How do I set up a swap partition?
I'm a nubie to Linux so any help will be greatly appreciated. Smiling

AdrianTM's picture

www.mepis.org/docs/index.php/

sag47's picture

What is SWAP?

First of all lessax,
You have to understand what a swap partition is before you can understand that you need it. It does not matter how much hard-drive space you have as to whether or not you need swap. What matters is how much RAM you have.

SWAP Memory has a very key function in an OS just like Windows Virtual memory (also refered to as a page file). When your computer is running any type of process, whether it be word processing, playing games, or even booting up, it loads those processes from the hard-drive into RAM to be run. Very seldom is a process actually run from your hard-drive. It's all run with RAM (Random Access Memory).

The reason? Because the transfer rate of RAM is much faster than a hard-drive. Now when you are running a whole bunch of processes, you sometimes run out of RAM because many people have 128MB or 512MB. Lets say you only have 512MB of RAM. When you have more than 512MB worth of processes it will overflow into SWAP.

So the SWAP partition is actually hard-drive space pretending to be RAM. Think of it as an overflow for a gas tank. When you fill it up too much it overflows into another tank.

What happens if you don't have a SWAP when that "overflow" occurs? Well your system will hang/freeze/crash and will have to have a thing known as a hard-reboot. A hard-reboot is when you physically press the power button for about 5 seconds and it shuts the computer off no matter what.

So unless you have a rediculous amount of RAM like 2gigs+ then I would say that you need swap. I setup a table below for how much SWAP should be used.

512MB and less of RAM = 1.5 to 2 GB of SWAP
1GB of RAM = 512MB to 1GB of SWAP
2GB+ of RAM = No swap needed at all

Remember those are just recommendations. But if you set it to those amounts you will never run out of RAM/SWAP memory when you are processing applications.

SAM


Play Savage for Linux! MEPIS Knowledge Base Articles
MEPIS Quick-Start Guide

lessax's picture

Swap Partition

I appreciate the information and, as I said in my original request, I have 2 GB of Ram on my system.
It seems from looking at my partition that I have just the one /dev/sda2/ext3 partition. I'm not sure how that happened but I would like a /home and a /swap partition set up but I am clueless as how to go about setting those up.I have tried using Qtparted but that just shows me the Windose and ext3 partition without any way, that I can determine, to change that setting.Puzzled

Jon Du Quesne's picture

Clarification Please

lessax, from within Mepis (use the Live CD) can you please give us the info from two commands? Open a Konsole, enter the following commands and paste the results back here:

mount            # will show what's currently mounted
cat /etc/fstab   # will show us names of all identified partitions.

Now, Mepis needs a minimum of two partitions: 1) swap, 2) root. According to you last post are you wanting to have "home" on a separate partition? If so, you will need a partition for that too. We can get to that in the next post. However, if your hard drive already has 4 partitions then you will have to make some changes to convert one to an "extended partition" into which you can put other partitions. (The new GParted Live CD is a wonderful tool).

I'll be happy to provide more details on how you can do that in the next post, but let's get on the same page as to what you currently have Smiling

Jon

lessax's picture

OK Jon From mount: dev/sda2

OK Jon
From mount:
dev/sda2 on / type ext3 (rw,noatime)
proc on /proc type proc (rw)
/sys on /sys type sysfs (rw)
varrun on /var/run type tmpfs (rw)
varlock on /var/lock type tmpfs (rw)
procbususb on /proc/bus/usb type usbfs (rw)
udev on /dev type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=100,mode=0622)
devshm on /dev/shm type tmpfs (rw)
capifs on /dev/capi type capifs (rw,mode=0666)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
and from fstab:
Pluggable devices are handled by uDev, they are not in fstab
/dev/sda2 / ext3 defaults,noatime 1 1
/dev/sda5 swap swap sw,pri=1 0 0
none /proc proc defaults 0 0
none /proc/bus/usb usbfs devmode=0666 0 0
none /dev/pts devpts mode=0622 0 0
none /sys sysfs defaults 0 0
# Dynamic entries below, identified by 'users' option
/dev/sda1 /mnt/sda1 ntfs noauto,users,exec,ro,umask=0222 0 0
/dev/cdrom /media/cdrom iso9660,udf noauto,users,exec,ro 0 0
/dev/fd0 /media/floppy vfat,ext2 noauto,users,exec,rw 0 0
Thanks for the response. Smiling

Allan Gabston-Howell's picture

Then again...

sag47's picture

Hey GH, What program are you

Hey GH,
What program are you running that takes up that much resources in the screenshot you provided?
SAM


Play Savage for Linux! MEPIS Knowledge Base Articles
MEPIS Quick-Start Guide

Allan Gabston-Howell's picture

On that shot, I was running

On that shot, I was running the GIMP, ImageMagick and Konq. No audio or video streams were involved.

Website: http://www.gabston-howell.org/
WebLog: http://www.gabston-howell.org/wl/
Must Reads for Newbies:
http://www.catb.org/~esr/faqs/smart-questions.html
http://www.tldp.org/

Jon Du Quesne's picture

OK Then!

lessax, thanks for the disk info!

Now, ignoring the "unimportant" mount points, you have /dev/sda1 as your ntfs (Windows) partition. /dev/sda2 is your (root) Linux partition. /dev/sda5 is your swap space. Now, judging by the fact that you jump from sda2 to sda5, I'm guessing that /dev/sda3 was created as an "extended" partition and it was subsequently turned into a "logical" partition for swap.

Here's the bad news. QTParted doesn't do real well when it comes to resizing partitions in an extended partition Sad

I downloaded a copy of the GParted Live CD:
DistroWatch.com: GParted LiveCD
http://distrowatch.com/table.php?distribution=gparted
And it is very nice. It has the ability to move, resize, and copy partitions. It might be a better tool in this case to see all of your partitions and move them around a bit.

Jon

lessax's picture

Thanks Jon

Thank you very much Jon.Smiling I really appreciate the help. As you can tell I'm very new at Linux.
I used Partition Magic in windose to create the swap partition and I'm not sure how the partitions got in that mess (I guess it's a mess). Anyway I'm downloading GParted and will use that to correct the partitions.
One more question though:: I understand that,in Linux,I need a
/Root and a /swap and a /home partition sooo how do I move my home stuff to the new partition.
Again thanks!!

Jon Du Quesne's picture

Don't "Need" /home Partition

Hey lessex! It is very common, and a good idea, to have a separate partition for home, but it is not necessary. You do have to have, at a minimum, the "swap" and "root" partition. The "root" paritition will be mounted as "/". It is under this root partition that everything else gets "mounted". If you do not have a separate home partition, a "/home" directory will be created and your "stuff" will be put there instead.

If you do want to have a separate partition for home (again, a good idea) then you can do this. I'm assuming that you already have a "/home" directory and it has stuff in it. Never fear. Log in as user root and make sure that your new partition has been made. Let's say that you decide to use the "ext3" file system for the new partition, and that it is located at /dev/hda3. Make sure that you are completely logged out as any regular user. Then, log in as user root (that way the /home directory is not being used.)

Back up and then modify the /etc/fstab file. You will need to add a line like this:

/dev/hda3  home  ext3  defaults,noatime  1 1

File the changes.
Next, rename the current "/home" directory

# cd /  # will move you to the "root" directory
# mv /home /home.old  # will get the original home out of the way
# mkdir /home  # will make a new home directory for a "mount point"

Then, test it.

# mount /dev/hda3 /home

You should see no errors.
Now, copy all your stuff from the original home to the new one

# cp -a /home.old/* /home

Let me know how it works.

Jon

lessax's picture

Worked like a charm

It worked great Jon. Many thanks. Smiling
I now have:
/dev/sda2 /
/dev/sda3 home
/dev/sda4 swap
finally!!

Jon Du Quesne's picture

Good Job!

Good Job lessax. Glad I could help. Welcome to the wonderful world of being a system (your own) administrator Smiling

Jon

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.