(no subject)

Rick Stevens ricks at nerd.com
Mon Jan 12 23:14:28 UTC 2009


Dave Scroggins wrote:
> Howdy Folks,
> 
> I have three Oracle DB servers, one main and two back up. I'm having
> trouble using SWAP on the backup machines.
> The main server seems to work just fine. The output from free is:
> 
> [root at db2 bkup-01-09]# free
> total       used       free     shared    buffers     cached
> Mem:       4154056    3882072     271984          0       7904    3718868
> -/+ buffers/cache:     155300    3998756
> Swap:      2031608     155964    1875644
> 
> The backup servers though don't seem to use SWAP. Free give the
> following:
> [root at db1 etc]# free
> total       used       free     shared    buffers     cached
> Mem:       4154056    3881176     272880          0      43288    3679652
> -/+ buffers/cache:     158236    3995820
> Swap:      2031608        144    2031464
> 
> I didn't' set the machines up so I'm not sure what is different. 
> 
> fstab for both machines are:
> 
> [root at db1 etc]# cat /etc/fstab
> # This file is edited by fstab-sync - see 'man fstab-sync' for details
> /dev/VolGroup00/LogVol00 /          ext3    defaults        1 1
> LABEL=/boot      /boot                   ext3    defaults        1 2
> none                    /dev/pts                devpts  gid=5,mode=620  0
> 0
> none                    /dev/shm              tmpfs   defaults        0 0
> none                    /proc                   proc    defaults        0
> 0
> none                    /sys                sysfs   defaults        0 0
> /dev/VolGroup00/LogVol01 swap                    swap    defaults       
> 0 0
> /dev/hda             /media/cdrom          auto   
> pamconsole,exec,noauto,managed 0 0
> /dev/fd0             /media/floppy           auto   
> pamconsole,exec,noauto,managed 0 0
> 
> Can someone point me in a direction to look?

Swap is used if the main memory is fully occupied by running processes.
If the primary machine (db2 I'm assuming) is handling all of the SQL
requests, then its memory may have been put under stress at some point
causing it to use swap.  free reports the high-water mark of swap (the
highest usage), not how much is being used NOW.  It won't be reset until
a reboot occurs.

The backup machine(s) probably never served any requests and didn't have
to use swap as they had adequate memory to handle whatever tasks you had
them doing.

I might also note that the normal set up for swap is twice the RAM size
(in your case, 4GB), so ideally you should set up 8GB swap.  Linux swap
_partitions_ can be a maximum of 2GB, but you can set up either multiple
2GB swap partitions or use a file-based swap (not as efficient as swap
partitions, but you can make them >2GB).

To use a swap file, find a partition with 8GB free on it, then, as root:

	# dd if=/dev/zero of=/path/to/swapfile bs=1M count=8192

where "/path/to" is a directory on the partition with 8GB free space and
"swapfile" is the name of the swapfile you want.  For example, let's say
we have 8GB free on /usr and we want to put the swapfile right there.
The command would be:

	# dd if=/dev/zero of=/usr/swapfile bs=1M count=8192

That creates an 8GB swap file named "/usr/swapfile".  Next, format
the file as swap:

	# mkswap /usr/swapfile

Once that's all done, you can change the /etc/fstab entry to use the
file as the swap.  The old entry may look like:

UUID=e7dbb97c-bc3e-405b-8a3d-31a2edda2a42 swap  swap  defaults   0 0

(using UUIDs) or
	/dev/mapper/VolGroup00-LogVol01 swap    swap  defaults  0 0

(using an LVM volume) or even

	/dev/sda3                       swap    swap  defaults  0 0

(using a disk partition) and change it to:

	/usr/swapfile                   swap    swap  defaults  0 0

When you reboot, the system would have an 8GB swap.
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer                      ricks at nerd.com -
- AIM/Skype: therps2        ICQ: 22643734            Yahoo: origrps2 -
-                                                                    -
-   To err is human.  To forgive, a large sum of money is needed.    -
----------------------------------------------------------------------




More information about the fedora-list mailing list