Solved

overlapping swap

Posted on 2000-05-12
6
385 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
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…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses

624 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