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 03-06-2004, 02:28 PM   #1
c0rderr0y
Member
 
Registered: Feb 2004
Distribution: Kubuntu
Posts: 71

Rep: Reputation: 15
Swap file question


i just noticed this now but i didnt have my swap file enabled in fstab. I enabled it now but it doest seem to use it. Is the swap file partition important? How come i have all of my swap file Free?
 
Old 03-06-2004, 02:36 PM   #2
TheOneAndOnlySM
Member
 
Registered: Jul 2003
Location: Dallas, TX
Distribution: Ubuntu 10.04 LTS
Posts: 987

Rep: Reputation: 30
let me make sure i understand
swap file: the file used to store temporary and relatively unimportant information on the root partition
swap space: a completely separate partition used for temporary memory

i assume you have swap space (as in, swap on a separate partition)

how does your fstab entry look like? post it here

also, you may need to use the command swapon /dev/hdx#

check your dmesg to make sure swap is actually not being loaded

and swap is not necessary, but highly recommended; it allows for much more efficient memory management (most noticeable under high usage environments)
 
Old 03-06-2004, 03:27 PM   #3
c0rderr0y
Member
 
Registered: Feb 2004
Distribution: Kubuntu
Posts: 71

Original Poster
Rep: Reputation: 15
oops yeah i meant swap partition

/dev/hda6 / ext3 defaults 1 1
/dev/hda5 swap swap defaults 1 1
/dev/hda1 /mnt/ntfs1 ntfs defaults,ro 0 0
/dev/hdb1 /mnt/ntfs2 ntfs defaults,ro 0 0
/dev/cdrom /mnt/cdrom iso9660 noauto,owner,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
proc /proc proc defaults 0 0

That is my fstab file how can i tell if my swap is being loaded with dmesg?
and how do i get it to boot with swap parition enabled?

edit: i tried the swapon but it said device or resource busy... but it is still not being used i see 100% free....

Last edited by c0rderr0y; 03-06-2004 at 03:33 PM.
 
Old 03-06-2004, 03:34 PM   #4
quatsch
LQ Addict
 
Registered: Aug 2003
Location: New York, NY
Distribution: gentoo, gentooPPC
Posts: 1,661

Rep: Reputation: 48
with those settings, swap should get moutned automatically at boot time. a quick way to see if your swap is activated is the command
free
If swap is enabled, you'll see a non-zero value for available swap space.

if you have lots of ram and don't do thigns that require lots of memory, it might never get used.
 
Old 03-06-2004, 05:46 PM   #5
TheOneAndOnlySM
Member
 
Registered: Jul 2003
Location: Dallas, TX
Distribution: Ubuntu 10.04 LTS
Posts: 987

Rep: Reputation: 30
definitely, like above said, you may not ever see your swap space used if you have decent ram and your environment isn't memory intensive

you definitely have swap enabled; it just isn't being used

if you want to see it used, run lots of programs, like open office, mozilla, mail, etc, or just run a game like unreal tournament or a game through wine; you will see it get used
 
Old 03-07-2004, 02:49 AM   #6
c0rderr0y
Member
 
Registered: Feb 2004
Distribution: Kubuntu
Posts: 71

Original Poster
Rep: Reputation: 15
i have 512 megs ddr400 ram with a Ti4600 vid card how big should my swap space be?
 
Old 03-07-2004, 10:32 AM   #7
quatsch
LQ Addict
 
Registered: Aug 2003
Location: New York, NY
Distribution: gentoo, gentooPPC
Posts: 1,661

Rep: Reputation: 48
depends. you can watch how much swap you use and then decide. But with 512MB of ram, a swap space of the same size should be more than enough. I have 512 MB machine with just 128MB of swap and I have no problems (I use it for web surfing and word processing).
 
Old 04-12-2004, 06:34 PM   #8
Law
LQ Newbie
 
Registered: Apr 2004
Location: Monterey, CA
Distribution: Slackware current, Slackware 9.1, Debian Current (and play with Slax, Knoppix, and Gentoo)
Posts: 2

Rep: Reputation: 0
Question How to increase swap usage under 2.6?

I have noticed similar swap behavior under 2.6. Swap space is activating correctly but has apparently not been used at all. In comparison, under 2.4 swap space would be used aggressively. In addition, I've noticed that my applications are distinctly less responsive with 2.6 than they had been under 2.4, and I had thought that this problem might be correlated to the swap space not being used. In particular, I can no longer play DVDs and X takes longer to perform standard tasks.

So I gave TheOneAndOnlySM's idea a try. After starting KWord, Kpresenter, Mozilla, 6 Konqueror sessions, the Gimp, Karbon14, and Gnumeric (not to mention X, KDE 3.2, and additional smaller accoutrements) I finally noticed swap usage:

Code:
$ free
             total       used       free     shared    buffers     cached
Mem:        386024     355208      30816          0      22580      85868
-/+ buffers/cache:     246760     139264
Swap:       401616       8400     393216
Not a lot, mind you. Is there a way to increase swap usage (for example, changing the vm_swappiness dial )? Would it help? Why is there such a huge difference between the swap usage under 2.4 and 2.6? If swap space is not the problem, why might I be having responsiveness problems under 2.6?

Thanks!
 
Old 04-13-2004, 03:18 AM   #9
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

Rep: Reputation: 87
High swap usage is a sign of a poorly tuned or underpowered system (with respect to the existing load). Ideally swap usage should be zero, ie, the lower the better. Keep in mind how/when swap works: swap will only be used when physical RAM is pushed past capacity and is forced to write out memory pages to the hard disk. This is bad, since reading/writing to physical media is orders of magnitude slower than RAM access, and therefore, just like others have suggested, you want swap usage to be minimal. To put it another way, you might want to consider your swap space as your RAM's last resort, and thus, you don't want it to be routinely used.

If you're interested in boosting system performance, I'd suggest either a faster CPU or more RAM. But forcing the system to use swap space will only aggravate the problem. If swap usage declines under 2.6 as compared to 2.4, that is a massively good thing. If you are encountering difficulty using certain apps or whatever, it's most likely due to the fact that you haven't enabled support for those things in the 2.6 kernel. Is your DVD an external USB device, and if so, do you have USB support enabled? -- J.W.
 
Old 04-13-2004, 10:52 AM   #10
Law
LQ Newbie
 
Registered: Apr 2004
Location: Monterey, CA
Distribution: Slackware current, Slackware 9.1, Debian Current (and play with Slax, Knoppix, and Gentoo)
Posts: 2

Rep: Reputation: 0
Indeed, not a swap problem

Thanks for your input - that makes a lot of sense. And it has turned out not to be a swap problem (in my case). As is so common, it has turned out to be a case of kernel (mis)configuration. In this case, I had left out the "Local APIC support on uniprocessors" and "MTRR (Memory Type Range Register) support" options.

I think the challenge for someone like me, who does not have a great understanding of the underlying hardware and how the OS utilizes it, lies in being able to correctly select the correct kernel options. It's always good to be able to experiment, though, and every time I have a problem and am able to solve it, I learn a bit more. In this case, I'm not sure exactly what impact those two options have. Perhaps someone here has more insight.
 
  


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
Fast Question: SWAP-file in Ubuntu disabled by default? Waerner Ubuntu 2 07-14-2005 09:57 AM
swap file question ashley75 Linux - General 6 06-09-2005 09:00 AM
Mount question and hot swap question Dr Gutiemouth Linux - Newbie 8 10-20-2004 12:30 PM
Swap File Cyric Slackware 13 10-04-2004 11:19 PM
swap file question jmdlcar Slackware 8 06-20-2004 01:47 AM

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

All times are GMT -5. The time now is 01:55 AM.

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