Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

overlapping swap

Posted on 2000-05-12
6
Medium Priority
?
438 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 200 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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…
Suggested Courses

876 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