[Query] Confusion of the Swap when using 'free -m' command


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers [Query] Confusion of the Swap when using 'free -m' command
# 1  
Old 12-17-2011
[Query] Confusion of the Swap when using 'free -m' command

Hi All,

I have just installed my first Linux server ( Ubuntu 11.10 ).
I am sure I didn't allocate /swap , and double check by 'df -h', yes really no /swap

but when I use 'free -m' , returned a "Swap" line as below.

Code:
     total       used       free     shared    buffers     cached
Mem:          3994       3768        225          0         65       3218
-/+ buffers/cache:        484       3510
Swap:          959          0        959

Where does this memory allocation come from? How can I remove it to free up the 959MB ? In what circumstances, this allocation will be used ?

Last edited by DukeNuke2; 12-17-2011 at 10:26 AM..
# 2  
Old 12-17-2011
Maybe this will help:
https://help.ubuntu.com/community/SwapFaq

To look for your swap partition

Code:
grep swap /etc/fstab

This User Gave Thanks to dude2cool For This Post:
# 3  
Old 12-17-2011
Quote:
Originally Posted by joaming
Where does this memory allocation come from? How can I remove it to free up the 959MB ? In what circumstances, this allocation will be used ?
Let me start with a question: Why are you so concerned about 1GB of space? ... Or: why are you so opposed to swap? I think you should read the link dude2cool posted. It looks like it's a good page of info.

In short: You can get rid of the swap space you have, and use it for something else, but it might be a lot of work.

You can get more information on the kernel's currently activated swap space with swapon -s (which simply shows you the content of /proc/swaps). Make note whether the output says something like "/dev/mapper/vg_apriori-lv_swap" or something like "/dev/sda6" -- you'll need this info later. Look at the man page for swapon/swapoff before using them for anything other than -s, but basically.. you could do a swapoff -a to turn off all registered swaps and then remove the appropriate [swap] entry from /etc/fstab, which would then allow you to reclaim that space.

In order to so, you'll either have to delete the swap logical volume (if your swap was on something that started with "/dev/mapper/...") and then extend your root (or home) logical volume ... OR, if you're really unlucky, you'll have to delete the swap partition and boot into something like PartedMagic in order to rearrange your partitions to make use of the freed up space.

Last edited by ryran; 12-20-2011 at 10:04 AM..
This User Gave Thanks to ryran For This Post:
# 4  
Old 12-19-2011
Quote:
Originally Posted by ryran
Let me start with a question: Why are you so concerned about 1GB of space? ... Or: why are you so opposed to swap? I think you should read the link dude2cool posted. It looks like it's a good page of info. ...
Basically, I am not opposed to swap. I just thought there are 4G physical memory that the probability of running out of memory approaches zero. After reading the SwapFaq which justifies the swap space with the "Unforeseeable Circumstances", I am happy with it. Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Swap completely used with memory free

I have a Solaris 10 VM that processes are seg faulting on (no space) and swap goes from 64GB to 151MB which triggers the seg fault. The free memory is 25GB when this occurs. I have adjusted the project to use all available ram. My question is why is swap being filled with 25GB remaining? the... (10 Replies)
Discussion started by: thefroggy
10 Replies

2. Programming

Swap call by reference confusion

Hello, This is very silly question as millions discussions on call-by-value vs call-by-reference for programming beginners, but I need to confirm my understanding. #include<stdio.h> void swap(int *p, int *q) //Line 3 { int tmp; tmp = *p; *p = *q; *q = tmp; } int... (15 Replies)
Discussion started by: yifangt
15 Replies

3. Shell Programming and Scripting

Swap usage by top and free command doesn't match

Its rather confusing, the output of top command is below: The "swap" field of top is described by the manpage as: "The swapped out portion of a task's total virtual memory image." But the output of free command suggests something else and it does tally with the output of swapon... (3 Replies)
Discussion started by: proactiveaditya
3 Replies

4. UNIX for Advanced & Expert Users

Query regarding swap memory

Hi, Please help explain and answer the below: 1. I need to predetermine how much swap will my JVM use if it is started with -Xms 512M and -Xmx 1024M ? 2. Can a JVM process just use the Heap and not the Swap memory ? 3. If the Total physical RAM on my server is 8 GB and current Heap... (6 Replies)
Discussion started by: mohtashims
6 Replies

5. UNIX for Dummies Questions & Answers

Query related to swap information shown by top command

Hi I have checked the output of top command in which there is a difference shown between the swap of top command for a process with total swap memory usage of the top command. Swap usage of process is higher than the total swap memory usage. top - 18:28:21 up 7:13, 5 users, load... (2 Replies)
Discussion started by: gagan2914
2 Replies

6. UNIX for Advanced & Expert Users

Mail command confusion

When i run this command on my linux machine: mail -s "CVS ALERT-CRITCAL" sandy@xyz.com The system hangs up producing a dead letter. What should i do to resolve this. I am using : mailx -s "CVS ALERT-CRITCAL" sandy@xyz.com This cammnd works fine on another Linux machine but says"... (14 Replies)
Discussion started by: bsandeep_80
14 Replies

7. Solaris

RAM and SWAP confusion

Hi Folks, This is my first post here - so nice to meet u all :-) Recently i was trying to dig a little bit into the memory structure of my machine and due to the lack of concept, cannot figure out a calculation. This is how it goes: 1) My swap slice is at the usual /dev/dsk/c0t1d0s1... (0 Replies)
Discussion started by: s4g3
0 Replies

8. UNIX for Dummies Questions & Answers

wc command confusion

Can somebody explain it to me that why wc gives more chars suppose Ab.txt have two lines qwer qasd then wc -c ab.txt will give 10.why not 8.okay may be it is taking count one for each line just in case but why echo "qwer"|wc -C gives 5. Ok with \c it is returning 4. :) (6 Replies)
Discussion started by: Dhruva
6 Replies

9. UNIX for Dummies Questions & Answers

Add SWAP to free slice

I'm interested in adding more swap space to my current workstation (Solaris 10). I currently have 2 hard drives installed, however the system was only created with 512MB for swap that resides on drive 1. This drive is already sliced up and all slices are being used. The second drive has two... (3 Replies)
Discussion started by: here2learn
3 Replies

10. UNIX for Dummies Questions & Answers

How do I find out how much swap and memory is free?

In Solaris 2.6 and 8 How do I find out how much swap and memory is free? Also how can I see how much memory each process is consuming? Thanks in advance (2 Replies)
Discussion started by: expos
2 Replies
Login or Register to Ask a Question