Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Red Hat This forum is for the discussion of Red Hat Linux.


  Search this Thread
Old 06-12-2006, 06:37 PM   #1
LQ Newbie
Registered: May 2005
Posts: 28

Rep: Reputation: 15
Need Help Increasing Swap by creating a swap file

Hi i have a server with 2gb of memory and i would now like to set the swap twice the size how can i do this with? I was thinking about creating a swapfile but can't remember how... can someone please guide me in creating this?

the is no more free space to create a partition...
Old 06-12-2006, 06:44 PM   #2
Senior Member
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 60
i believe the commands are 'swapon' and 'mkswap'
i dont think you should bother wasting harddrive space with swapping on a system with this much memory. swap files are used after physical memory is full and is much slower. with 2GB of memory, is your system really using all of this at any one time? if you really want to have a swap file i would definetly not make it 4GB. maybe 0.5GB.

just my opinion.
Old 06-13-2006, 05:43 AM   #3
Registered: May 2004
Posts: 52

Rep: Reputation: 15
The best would be to create another swap partition.
If you realy want swap file...

dd if=/dev/zero of=swapfile bs=1024 count=X

where X is number of blocks

chmod 600 swapfile

mkswap swapfile

swapon swapfile

edit your fstab

/your_dir/swapfile swap swap defaults 0 0
Old 06-13-2006, 09:04 AM   #4
LQ Newbie
Registered: May 2005
Posts: 28

Original Poster
Rep: Reputation: 15
Hey thanks alot works great


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
mem and swap usage increasing daily epoo Linux - General 5 05-02-2005 12:49 AM
increasing swap on a slow pc ejbest Linux - Newbie 1 10-24-2004 11:30 AM
Increasing swap space rupesh_pulikool Linux - Networking 1 09-12-2004 11:40 PM
increasing the swap space after installing linux LinToWinWin Linux - Newbie 4 08-03-2004 10:51 PM
Increasing swap partition suneet123 Linux - Software 3 12-16-2002 04:11 PM > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 06:00 PM.

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