LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How can I check whether I have a swap partition in Suse Linux 9.2 pro? (https://www.linuxquestions.org/questions/linux-software-2/how-can-i-check-whether-i-have-a-swap-partition-in-suse-linux-9-2-pro-289603/)

pujolasdf 02-13-2005 06:59 AM

How can I check whether I have a swap partition in Suse Linux 9.2 pro?
 
That's it. I'm not sure if I actually have a swap partition working, that's because the installation programme didn't tell me anything about swap partitions and my computer almost freezes when doing some kind of odd commands, such as cat /dev/hda1 (my 55GB-almost-full-windows partition).

Thanks in advance.

jonaskoelker 02-13-2005 07:14 AM

$ df -h
if it says 'tmpfs', you definitely have a swap partition. To check if it's working, open some kind of swap-space-usage-meter (the GNOME applet 'system monitor' or similar should do), then start python:
$ python
>>> a = []
>>> while True: a.append(range(100))
...
(^C)
KeyboardInterrupt
>>> (^D)
$ (^D)

it should fill up your memory pretty fast, forcing the kernel to swap out something. If it can't, because you have no swap, you'll probably get a MemoryError (or similar) from python; of course, you might get the same message when running out of swap, so the swap-o-meter comes in handy.

Hope this helps,

Jonas

druuna 02-13-2005 07:16 AM

Hi,

fdisk -l /dev/hdX X being a, b. There should be an entry like this:

/dev/hda1 1 499 4008186 82 Linux swap

hda1 is just an example, could differ for you.

free and top show swap space (and how much is used).

Take a look at your /etc/fstab file, there should be an entry like:

/dev/hda1 swap swap sw,pri=128 0 0

hda1 being your swap partition. Again hda1 is just an example and sw,pri=128 can be different too.

Hope this helps.

syg00 02-13-2005 07:18 AM

swapon -s
Bit simpler than cat /proc/swaps

pujolasdf 02-13-2005 07:19 AM

Hey, that was great! I think I have it working, but it says I only have 125MB of swap space, is it enough? Somewhere I heard that it should be about 2GB, I think. In any case, is any way of expanding it without destroying my other partitions? I mean in a Windows Partition Magic way for linux or something.

Thank you in advance again ;D

kevinatkins 02-13-2005 07:19 AM

hi,

i think you could also use 'top' - it'll tell you all about what processes are running and give memory information, including any swap space..

pujolasdf 02-13-2005 07:25 AM

Hi and thank you to all of you for replying so incredibly fast!!

This is somewhat curious: (I don't have the fdisk command installed, it says 'command not found', maybe suse 9.2 pro doesn't install it in its typical installation..) when I type df I can see 125MB of swap space, but when I type cat /etc/fstab I can't see any swap partition, even more, I can't see the word 'swap' in the whole output! Maybe the swap space is in my main linux etc3 partition making its performance undergo a lot?

Thank you again!

syg00 02-13-2005 07:34 AM

Quote:

Originally posted by pujolasdf
Hey, that was great! I think I have it working, but it says I only have 125MB of swap space, is it enough? Somewhere I heard that it should be about 2GB, I think. In any case, is any way of expanding it without destroying my other partitions?
How long is a piece of string ???.
Like most ROTs (rule of thumbs) they are out of date as soon as they are formulated. All the swap ROTs are from a time (not that long ago) when large RAM was uncommon.
If you have half a Gig or more (of RAM) don't worry too much about swap unless you are a *heavy* user. Oracle comes out with stupid numbers like you mentioned.
Swap can always be added if you have spare disk space - Linux supports multiple swaps.

pujolasdf 02-13-2005 07:43 AM

Okay, that's my output at cat /etc/fstab:

/dev/hda4 / reiserfs acl,user_xattr 1 1
/dev/hda1 /windows/C ntfs ro,users,gid=users,umask=0002,nls=utf8 0 0
/dev/hda3 /windows/D vfat users,gid=users,umask=0002,iocharset=utf8 0 0
/dev/hda5 /windows/E vfat users,gid=users,umask=0002,iocharset=utf8 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
proc /proc proc defaults 0 0
usbfs /proc/bus/usb usbfs noauto 0 0
sysfs /sys sysfs noauto 0 0
/dev/cdrecorder /media/cdrecorder subfs fs=cdfss,ro,procuid,nosuid,nodev,exec,iocharset=utf8 0 0
/dev/fd0 /media/floppy subfs fs=floppyfss,procuid,nodev,nosuid,sync 0 0

I only have 256MB of RAM, but I'm planning to buy more. I'm worrying about swap space because of I execute some hugely CPU or RAM consuming programmes, my suse linux 9.2 pro system almost hangs, and I barely can CTRL+C, CTRL+ALT+BACKSPACE it. Sometimes it is completely impossible and I have to plug off my computer :(

syg00 02-13-2005 08:05 AM

Quote:

Originally posted by pujolasdf
I only have 256MB of RAM, but I'm planning to buy more. I'm worrying about swap space because of I execute some hugely CPU or RAM consuming programmes, my suse linux 9.2 pro system almost hangs, and I barely can CTRL+C, CTRL+ALT+BACKSPACE it. Sometimes it is completely impossible and I have to plug off my computer :(
256 is a not large these days - try cfdisk /dev/hda
If you have some free space, create a partition of say 512Meg - make it larger if you want. Then,
then
Code:

mkswap /dev/hda? (whatever you created)
swapon /dev/hda?

Then add it it to fstab as;
Code:

/dev/hda?    none    swap      sw              0  0
Looks like you may be correct about the current swap being allocated within a file system - I don't know Suse.
edit if commands don't work, try them as /sbin/?????

pujolasdf 02-13-2005 05:24 PM

Ok, I've run fdisk and killed an old, useless and experimental-purpose win98 partition. Now I want it to be my swap, it's about 7,5 GB but I just want 1 GB of it. I've removed it with fdisk, made mkswap and swapon as root (thanks for the tip, didn't work without being root :D) but when I introduce the swapon command it tells me that partition is busy. Then, I restarted my computer but in grub I still could see a "windows 2" boot possibility and linux mounted again the partition with all the files in it (!!!??). I saved changes in fdisk, what's going on?


All times are GMT -5. The time now is 07:16 PM.