LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 11-03-2009, 11:24 AM   #1
wtb
LQ Newbie
 
Registered: Sep 2009
Posts: 20

Rep: Reputation: 0
Virtual memory in RHEL


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.
 
Old 11-03-2009, 11:54 AM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
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.
 
Old 11-03-2009, 12:05 PM   #3
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
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.
 
Old 11-03-2009, 12:41 PM   #4
DrLove73
Senior Member
 
Registered: Sep 2009
Location: Srbobran, Serbia
Distribution: CentOS 5.5 i386 & x86_64
Posts: 1,118
Blog Entries: 1

Rep: Reputation: 129Reputation: 129
Maybe skilled programmer could automatically mount next swap file if active swap partition or file is running full.
 
Old 11-03-2009, 01:34 PM   #5
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
@DrLove73: Possibly so. But if that's your reality, you should invest in more RAM.
 
Old 11-03-2009, 03:16 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,139

Rep: Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122
"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.
 
Old 11-04-2009, 02:14 AM   #7
DrLove73
Senior Member
 
Registered: Sep 2009
Location: Srbobran, Serbia
Distribution: CentOS 5.5 i386 & x86_64
Posts: 1,118
Blog Entries: 1

Rep: Reputation: 129Reputation: 129
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 .
 
Old 11-04-2009, 04:34 AM   #8
wtb
LQ Newbie
 
Registered: Sep 2009
Posts: 20

Original Poster
Rep: Reputation: 0
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
 
Old 11-04-2009, 04:42 AM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,139

Rep: Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122
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.
 
Old 11-04-2009, 10:25 AM   #10
wtb
LQ Newbie
 
Registered: Sep 2009
Posts: 20

Original Poster
Rep: Reputation: 0
Yes you're right syg00, thanks for your answer. I'll try with a swap file to begin.
 
  


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
pthreads virtual memory usage -- memory is not freed after thread exit minimol Linux - General 2 05-26-2009 01: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 12:04 PM
Linux shared memory segment access problem and x86 Virtual Memory layout. regmee Linux - Kernel 1 08-23-2008 12:11 AM
Difference between resident memory,shared memory and virtual memory in system monitor mathimca05 Linux - Newbie 1 11-11-2007 04:05 AM
RH 8.0 Mapping Virtual Memory to get access to VMIC Reflective Memory PCI card. Merlin53 Linux - Hardware 0 05-05-2003 12:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

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