Solved

overlapping swap

Posted on 2000-05-12
6
317 Views
Last Modified: 2010-04-21
I recently saw a system where they had swap on /tmp (as in a worstation) but had then added c0t0d0s1 as a swap partition. I said they were in error and that they could have as many swap partitions as they like but not in conjunction with swap on /tmp. But I can find no reference to this. Has anyone else come across this ?
0
Comment
Question by:mark.dudley
6 Comments
 
LVL 12

Expert Comment

by:geotiger
ID: 2805893
There are good and bad about using /tmp as part of swap. The good thing about it is that you are more efficiently using /tmp space. The very bad thing about it is that if you have only /tmp as your swap space, the system will be hung or crashed if users used all the /tmp space.

As long as there is (are) other partition(s) added to swap list, it is ok to use /tmp as swap space.
0
 

Expert Comment

by:nicob
ID: 2810261
Hi,

It is normal behaviour for unix to use /tmp as temporary directory and as swap. You can afterwards configure more swap partitions, but the first swap you configure will always be used for both swap and /tmp. This has nothing to do with if it is a workstation or a server, it is a unix standard.

This is also why you have to configure swap/tmp with a 2 x memory size. This will prevent swap/tmp from filling up quickly. If you have a system with 500Mb of memory then you will have to make a /tmp filesystem of 1Gb, this because it can then use /tmp to dump its total memorysize incase the system crashes and does a crashdump.

So you will see that when you do a df -k on a unix system (solaris in this case) then you will get the following output :

nicob@sis250% df -k
Filesystem  kb     used   avail     capacity  
swap   2791608    1024 2790584     1%    /tmp

nicob@sis250% swap -l
swapfile             dev  swaplo blocks   free
/dev/dsk/c0t0d0s1   32,1      16 4197856 4197856

Hope this answers the question.

Regards,

Nico.
0
 

Author Comment

by:mark.dudley
ID: 2810979
mounting swap on /tmp does not give you your first swap space, as I understand it. It says you should use virtual memory for /tmp - giving less swap space.
On reflection I dont think this partition is likely to have caused the error I saw.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 12

Expert Comment

by:geotiger
ID: 2815501
What error? The one danger (sometime fatal) is running out of space in /tmp if you have /tmp as your only swap space since users can write to /tmp. Other than that, /tmp should act as usual as other partitions for swap.
0
 

Accepted Solution

by:
klmorris052500 earned 100 total points
ID: 2847754
Long story short.  /tmp is swap.  Try this...

from a valid file system (other than /tmp!!):

df -k /tmp
mkfile 10m swap_test
swap -a swap_test
df -k /tmp

You will see that /tmp has grown by 10Mb.  To undo what you've done:

swap -d swap_test
rm swap_test
df -k /tmp

/tmp returns to it's normal size.

The basic entries in /etc/vfstab (solaris) are as follows:

/dev/dsk/c0t0d0s1  -  -  swap  -  no  -
swap  -  /tmp  tmpfs  -  yes  -

The system needs to know two things:

1) What partitions or empty files to use for swap space.
2) Where to mount swap space.  

You could just as easily change the /tmp to something like /swap.  It's just that the standard recommended practice is to make it /tmp.
0
 

Expert Comment

by:klmorris052500
ID: 2847786
Also, to add additional swap to the system, create a file as indicated above, and put this in your /etc/vfstab:

<fully qualified path to new file>  -  -  swap  -  no  -

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Access Required to Read Linux Security Settings and User Permissions 13 112
Unix Command -- Challenging  question 7 86
check unix curl command return value 7 83
Access_log 17 97
Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now