Link to home
Start Free TrialLog in
Avatar of mark.dudley
mark.dudley

asked on

overlapping swap

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 ?
Avatar of geotiger
geotiger

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.
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.
Avatar of mark.dudley

ASKER

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.
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.
ASKER CERTIFIED SOLUTION
Avatar of klmorris052500
klmorris052500

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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  -