LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-12-2006, 03:18 AM   #1
x0rx
LQ Newbie
 
Registered: Sep 2006
Posts: 2

Rep: Reputation: 0
No Swap partition causing my machine to freeze up?


Hey all,
the other day I decided to reinstall slackware after i found out that there was a driver available my wireless usb card (hurray!), the installation was abit hit and miss, QT didnt install properly (I installed the package after first boot from the cd) and every time I tried to format the swap partition the machine seemed to give up (I have 2 gig of ram and I made 1 gig partition using fdisk) I remember someone rightly or wrongly telling me that swap partitions aren't 100% necessary. So after the process took an hour and still hadn't completed I gave up (and tried again, on more than 2 ocassions), I eventually decided to install slackware 10.2 without the partition, my machine specs are as follows.

Code:
AMD's Athlon 64 3000+
2 gig ram
nvidia 6600 GT
60 gig harddrive/200 gig hard drive
currently only the 60 gig hard drive is even in my fstab.

So far since yesterday, my machine has frozen randomly for about 30 seconds at a time, the first time, all I was doing was using amsn and the second time I'd just issued "find / -name Styles"

I was wondering, is this anything to do with me not having a swap partition and if so, is there an easy way to create one without actually reinstalling.

It's probably worth noting that I have installed the nvidia drivers and my kernel is just the standard 2.4 one that comes with slackware 10.2 (I'm not brave enough to compile a 2.6 one yet, because I never get it right ;[)

Thanks alot , I look forward to your replies.

x0rx
 
Old 09-12-2006, 08:27 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
I've never installed Linux/UNIX without a swap partition. Whoever told you they aren't necessary either knows a lot more or a lot less than I do.

What is true is that "swapping" doesn't actually occur in modern Linux/UNIX. However "paging" does and it uses the swap space. Also swap space + physical memory determines your "virtual memory". When programs start they try to preallocate a certain amount of memory. A lot of this does NOT have to be in physical memory. If you have no swap these preallocations all have to go into physical memory so you might in fact be memory constrained. By having swap a good chunk of this "virtual memory" preallocation is in swap and not in physical memory.

You can create swap devices (assuming you have free partitions or are using LVM with free space left in the VolGroup) or swap files.

Type "man mkswap" for information on how to create swap areas. swap devices are the way to go if possible.

The old rule of thumb was to make swap = 2 X Physical Memory. Typically 1.5 X is sufficient and I've seen people do just 1 X. Being old school though, I always do the 2 X so long as I have sufficient disk space.
 
Old 09-12-2006, 08:43 AM   #3
TruongAn
Member
 
Registered: Dec 2004
Location: Vietnam (Việt Nam)
Distribution: Gentoo (desktop), Arch linux (laptop)
Posts: 728

Rep: Reputation: 33
Not true.
Swap means nothing much as long as you still have enough memory.
I have try to disable swap partition for sometimes, it run OK.
But when I startx and other X appications, the RAM is dry up and my PC run slower and slower and finally freeeze.
But If I don't start too many app things went straight. I even don't recognize that I have no swap until it free tell me
 
Old 09-12-2006, 08:55 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
2 Gig of RAM and you're using a 2.4 kernel ???.
Sheesh ...
Time to move into this century (same comment applies to Pat obviously).

Pull a Gig out and see how it runs.

I agree swap is always (normally) a good thing, but with that much memory I can't see an issue - if it was 2.6 anyway.
There's a guy called the OOM killer that would have something to say if it was a swap issue - and I'd expect you to hear about it.
Sounds like you have some other problem.
 
Old 09-12-2006, 11:17 AM   #5
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Quote:
Originally Posted by TruongAn
Not true.
Swap means nothing much as long as you still have enough memory.
I have try to disable swap partition for sometimes, it run OK.
But when I startx and other X appications, the RAM is dry up and my PC run slower and slower and finally freeeze.
But If I don't start too many app things went straight. I even don't recognize that I have no swap until it free tell me
Exactly what is "not true"?

swap DOES increase virtual memory and IS used for paging. While tons of physical memory reduces page ins in normal operation page outs aren't a problem and are desirable to free physical memory.
 
Old 09-15-2006, 06:07 AM   #6
TruongAn
Member
 
Registered: Dec 2004
Location: Vietnam (Việt Nam)
Distribution: Gentoo (desktop), Arch linux (laptop)
Posts: 728

Rep: Reputation: 33
Quote:
Originally Posted by jlightner
Exactly what is "not true"?
I just means Swap doesn't cause system to freeze if you still have plenty of RAM. Correct me if i'm wrong.
 
Old 09-15-2006, 07:30 AM   #7
lior.okman
LQ Newbie
 
Registered: Sep 2006
Distribution: Debian GNU/Linux
Posts: 9

Rep: Reputation: 0
Creating a swap without re-installing

Hi,


You have quite a few options.

1. Create a swap partition on your second hard drive
2. Create a swap file on your existing drive.
3. Resize your filesystem, repartition and create a swap partition on your first 60G drive.


For finding out if the lack of swap is freezing your computer, try this (as root):

Code:
dd if=/dev/zero of=/swapfile.swp bs=1M count=512 
mkswap /swapfile.swp
swapon /swapfile.swp
Explanation:
1. The first command will create a file called "swapfile.swp" in your root "/" directory. The file will be 512Mb of binary zeros.

2. The second command will format the file to be a valid Linux swap file.

3. The third command will inform the kernel about the new swap area and allow the kernel to actually use it.


The 2.4 kernel had lots of issues with tight memory conditions, and the OOM process would then kill programs. However, the binary nvidia drivers are my bet about what is freezing your computer.

If you decide you want to keep the swap file across boots, just add an entry in your /etc/fstab file that looks like this:

Code:
/swapfile.swp       none            swap    sw              0       0
Creating a swap partition is nearly the same - just create the partition (using fdisk or any other disk partitioning software), and run mkswap on the new partition. Afterwards, add it to your /etc/fstab file, so it will be automatically used by the kernel on the next boot, and manually activate it with the swapon command so you don't need to immediatly reboot.
 
Old 09-15-2006, 08:34 AM   #8
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
I don't think lack of swap all by itself wouldn't cause a system freeze. However if one were starting sufficient processes that attempted to allocate "virtual memory" which was the same as "physical memory" due to the lack of swap they could quickly memory constrain their box.

Not sure if Linux has an analog but I have seen serious "freezes" on HP-UX (UNIX) due to memory constraints. Essentially wha happened is that if memory is near full it would run a process to "steal" back from what was allocated to buffer cache and older processes (something like a 3 to 1 ratio). Since the daemon that did this ran at the highest Posix real time priority it meant the CPU would respond to no other requests so the system appeared to "freeze". Eventually it would "unfreeze" but then buffer cache would start to grow and it would occur again. This is called memory thrashing. I know Linux preallocates buffer cache but don't know if it has a similar daemon to steal back in tight memory situations but suspect it does.
 
Old 09-15-2006, 05:09 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
kswapd - runs "all the time" in need.
Can't imagine a home user running into problems with that much memory.
2.4 had poor (user) controls of aspects of the vm - 2.6 has rectified this to some extent, and more appear over time.
However, I really think the OP has other problems - maybe something like the nvidia drivers mentioned above.
 
Old 10-18-2006, 09:08 AM   #10
MyNameIsMatthew
LQ Newbie
 
Registered: Oct 2006
Posts: 1

Rep: Reputation: 0
Swap file

You had a problem during installation. You need to look at what is taking place during the install. to the information being written to the drive. You have some bad sectors on the drive and will need to partition around or past those points. Your system is freezing up because the programs may be written to bad spots on the drive and causing some issues.


I am looking into running an embedded system and can not use a swap.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Amuled causing system to just freeze up! HELP! ShiftyPowers Ubuntu 2 02-14-2006 11:00 AM
Swap Partition in SuSe 9.1 Pro is increasing radicaly and causing system to crash tontito_tx Linux - Newbie 3 02-28-2005 12:47 PM
WUSB11 v2.8 causing keyboard to freeze up in Mandrake 10.1 Shadowslayer Linux - Wireless Networking 0 02-26-2005 10:38 PM
regular user program causing system freeze win32sux Slackware 2 02-07-2005 07:32 PM
rdesktop causing XP machine to sleep bleargh Linux - Software 6 12-12-2004 03:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration