LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices

Reply
 
Thread Tools
Old 11-03-2009, 12:24 PM   #1
wtb
LQ Newbie
 
Registered: Sep 2009
Posts: 8
Thanked: 0
Virtual memory in RHEL


[Log in to get rid of this advertisement]
Hi all,


On one hand there is the swap partition but on the other hand, is there any pagination file for the virtual memory under RHEL 4.6 ?

Like under Windows, there is a swap file growing in the course of using applications.

If this file exists, and I think that it exists, where is it ? And someone can tell me how to increase or reduce the size of this file ?


Thanks !



PS : Sorry for my bad english.
windows_xp_2003 wtb is offline     Reply With Quote
Old 11-03-2009, 12:54 PM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Fedora, FreeBSD
Posts: 2,391
Thanked: 81
The swap partition serves the same purpose as a page file. It is a fixed size (created by you), but you can expand it or reduce it using various methods. Normally, you shouldn't need to do that.

Explain more about your situation if you need specific help.
linuxfedora anomie is offline     Reply With Quote
Thanked by:
Old 11-03-2009, 01:05 PM   #3
johnsfine
Senior Member
 
Registered: Dec 2007
Posts: 1,687
Thanked: 182
Quote:
Originally Posted by wtb View Post
On one hand there is the swap partition but on the other hand, is there any pagination file for the virtual memory under RHEL 4.6 ?
If you choose, you can use a swap file instead of or in addition to a swap partition.

Quote:
Like under Windows, there is a swap file growing in the course of using applications.
Having the swap file grow on demand is one of the bad features of Windows and one of the reasons Linux memory management is more efficient and more reliable.

A swap file that grows automatically as it is used is significantly more complicated than one whose size is fixed. It is a feature that could be done well by an expert OS programmer, but in Windows it was not done well and so far as I understand, in Linux it was not done at all.

In Linux, you need to decide on the amount of swap space.
windows_xp_2003 johnsfine is offline     Reply With Quote
Thanked by:
Old 11-03-2009, 01:41 PM   #4
DrLove73
Member
 
Registered: Sep 2009
Location: Srbobran, Serbia
Distribution: CentOS 5.4 i386
Posts: 295
Thanked: 20
Maybe skilled programmer could automatically mount next swap file if active swap partition or file is running full.
linux DrLove73 is offline     Reply With Quote
Thanked by:
Old 11-03-2009, 02:34 PM   #5
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Fedora, FreeBSD
Posts: 2,391
Thanked: 81
@DrLove73: Possibly so. But if that's your reality, you should invest in more RAM.
linuxfedora anomie is offline     Reply With Quote
Old 11-03-2009, 04:16 PM   #6
syg00
Guru
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 6,916
Thanked: 167
"swapon -s" will show the currently in-use swap extents.
Redhat have (or had) some documents on their site to walk you through adding/reducing swap space. Several scenarios need to be catered for.
As for dynamically adding, merely (always) activating extras is sufficient - kswapd will by default fill each in turn as needed unless told otherwise.
syg00 is offline     Reply With Quote
Thanked by:
Old 11-04-2009, 03:14 AM   #7
DrLove73
Member
 
Registered: Sep 2009
Location: Srbobran, Serbia
Distribution: CentOS 5.4 i386
Posts: 295
Thanked: 20
Quote:
Originally Posted by anomie View Post
@DrLove73: Possibly so. But if that's your reality, you should invest in more RAM.
I do not need it. 2GB is enough for my needs. I do not recall last time I've seen my PC used swap. I was giving a possible solution to wtb .
linux DrLove73 is offline     Reply With Quote
Old 11-04-2009, 05:34 AM   #8
wtb
LQ Newbie
 
Registered: Sep 2009
Posts: 8
Thanked: 0

Original Poster
Thanks for the answers.

I made a research in Redhat documentation with the elements you gave me and I found that there are different ways to modify swapping.


1. Create a new swap partition
2. Create a new swap file
3. Extend swap on an existing LVM2 logical volume


RH recommends the option 3. But to do it you must have a LVM logical volume or need to create one. I think it's probably the best option but not the more easy to do.


For those who are interested, this is the procedure for the creation of a swap file :

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

add this line in /etc/fstab to enable the partition at boot time :
/swapfile swap swap defaults 0 0


source : swap-creating-file.html
windows_xp_2003 wtb is offline     Reply With Quote
Old 11-04-2009, 05:42 AM   #9
syg00
Guru
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 6,916
Thanked: 167
There is no point installing LVM just for swap - if you have a vg with space, use that. Else just create partitions/files in your current setup. Despite what you might read on the net, there is no adverse effect in using swap files rather than swap partitions with 2.6 kernels.
syg00 is offline     Reply With Quote
Thanked by:
Old 11-04-2009, 11:25 AM   #10
wtb
LQ Newbie
 
Registered: Sep 2009
Posts: 8
Thanked: 0

Original Poster
Yes you're right syg00, thanks for your answer. I'll try with a swap file to begin.
windows_xp_2003 wtb is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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
pthreads virtual memory usage -- memory is not freed after thread exit minimol Linux - General 2 05-26-2009 02:19 AM
Possible to have virtual machine in RHEL 5.1 run RHEL 4.0-1 ES (64-bit) maryjane Linux - Newbie 1 10-20-2008 01:04 PM
Linux shared memory segment access problem and x86 Virtual Memory layout. regmee Linux - Kernel 1 08-23-2008 01:11 AM
Difference between resident memory,shared memory and virtual memory in system monitor mathimca05 Linux - Newbie 1 11-11-2007 05:05 AM
RH 8.0 Mapping Virtual Memory to get access to VMIC Reflective Memory PCI card. Merlin53 Linux - Hardware 0 05-05-2003 01:50 PM


All times are GMT -5. The time now is 02:29 AM.

Main Menu
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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration