LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 01-15-2004, 02:48 AM   #1
jogurt666
Member
 
Registered: Nov 2003
Location: Poland => Mazowieckie => Ok'a
Distribution: Gentoo
Posts: 176

Rep: Reputation: 30
how do i make a swapfile in debian?


i've tried to make a swapfile for my system. i've done the following things:

# dd if=/dev/zero of=/swapfile bs=1024 count=524288
# mkswap /swapfile
# swapon /swapfile

but i'm told that /swapfile is an invalid argument? well i've added a swapfile this way in redhat9 and it worked. what should i do here?
 
Old 01-15-2004, 07:19 AM   #2
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,987

Rep: Reputation: 388Reputation: 388Reputation: 388Reputation: 388
The "dd" part looks alright, but I think your suppose to include the block count with the mkswap command:

# mkswap /swap 524288

Also, I believe your suppose to run the "sync" command after you run mkswap to make sure the format info has been written to the new swap file.

You can do it that way with a swap file, but most people would use a separate swap partition. It's suppose to give better performance because the blocks on a swap partition will always be contigous. Not so if you use a swap file.
 
Old 01-15-2004, 12:52 PM   #3
jogurt666
Member
 
Registered: Nov 2003
Location: Poland => Mazowieckie => Ok'a
Distribution: Gentoo
Posts: 176

Original Poster
Rep: Reputation: 30
it works thnx. well i already have a swap partition, however every linux documentation says that my swap space should be at least my RAM multiplied by two. well i have 512MB of RAM, and i've got no free space on my HDD where i could make another swap partition, so i need a swapfile.
 
Old 01-15-2004, 01:05 PM   #4
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally posted by jogurt666
it works thnx. well i already have a swap partition, however every linux documentation says that my swap space should be at least my RAM multiplied by two. well i have 512MB of RAM, and i've got no free space on my HDD where i could make another swap partition, so i need a swapfile.
That can be misleading you really do not need much swap space when you start to get larger amounts of ram installed. I noticed when I had 512mb in my main computer the /swap rarely if ever got used and when I put another 256mb in it then the /swap never gets used.
 
Old 01-15-2004, 01:11 PM   #5
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,987

Rep: Reputation: 388Reputation: 388Reputation: 388Reputation: 388
That's an old rule that has little relevance with todays high memory configurations. You don't need 1GB of swap if you have 512MB of ram. Check your memory usage and see how often you even go into swap with 512MB of ram. Hardly at all I'd venture to guess unless your doing some really intensive, wierd multitasking. 500MB of swap is more than enough with your ram and I doubt that you'll ever use even a fraction of that swap. I wouldn't bother with the swap file unless your running into a lot of out of memory conditions.
 
Old 01-15-2004, 02:23 PM   #6
jogurt666
Member
 
Registered: Nov 2003
Location: Poland => Mazowieckie => Ok'a
Distribution: Gentoo
Posts: 176

Original Poster
Rep: Reputation: 30
well i thought that i may run out of it, since my system hangs sometimes. i've got no idea why. during kernel configuration i've chosen my processor type (that is Athlon) and enabled kernel support for big memory systems. it now works more stabile, but sometimes still hangs. if not by adding swap, how can i root the problem out?

and btw

how do i check memory usage?
 
Old 01-15-2004, 02:42 PM   #7
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 48
Simply type free to get a read out of your memory consumption.
 
Old 01-15-2004, 06:00 PM   #8
vectordrake
Senior Member
 
Registered: Nov 2003
Location: NB,Canada
Distribution: Something alpha or beta, binary or source...
Posts: 2,280
Blog Entries: 4

Rep: Reputation: 47
I read an interesting article somewhere that advocates a swap partition (not always the biggest though) regardless of RAM size. Had to do with swapping out processes that were inactive. I wish I remembered where I found that...
 
Old 01-18-2004, 03:44 AM   #9
ac1980
Member
 
Registered: Aug 2003
Location: Trento, Italy
Distribution: Debian testing
Posts: 394

Rep: Reputation: 30
1. A good way to know if your swap is being used is to put a "system monitor" applet into your Gnome/KDE panel and configure it toshow swap. Note that memory will always appear almost full, unless you change the color for buffer/cache
2. There is a good reason to always have some swap: if a process for any reason go crazy and starts forking on and on, without swap it may fill memory before you actually know, making it hard even to manage to kill it. If you have swap, after a while the pc will not hang, but slow down a lot, so further forks will not be as fast, and you can get a console and killall the process.
 
Old 01-18-2004, 09:11 AM   #10
vectordrake
Senior Member
 
Registered: Nov 2003
Location: NB,Canada
Distribution: Something alpha or beta, binary or source...
Posts: 2,280
Blog Entries: 4

Rep: Reputation: 47
An effective way with number values is to have TOP running in a minimized terminal. Then you have a numerical value to work with. I suggest something really light like RXVT, which will snap to attention and not take up mant more resources
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I get my swapfile to work? Mr. New Linux - Newbie 2 01-01-2005 11:37 AM
swapfile doesn't work kozgun Slackware 7 10-20-2004 12:42 AM
SuSe swapfile Pond247 Linux - Newbie 0 09-19-2003 02:17 PM
command to check swapfile? Scruff Linux - General 5 09-15-2003 09:47 PM
Swapfile Shantesh Linux - Software 2 09-11-2003 08:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 05:04 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