Solved

overlapping swap

Posted on 2000-05-12
6
316 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
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…
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 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…

744 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

13 Experts available now in Live!

Get 1:1 Help Now