Swap which option is better


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Swap which option is better
# 1  
Old 08-29-2011
Swap which option is better

hi guys

I got 4 server which have 756MB swap


Code:
swapon -s
Filename                                Type            Size    Used    Priority
/dev/sda1                               partition       763048  0       -1

Now this needs to be increased to 8GB.
I've been reading about increase SWAP space:
options are:
1. Create a new Swap on a new partition.
2. Increase the actual swap gparted software is needed
3. Create a new file using dd command

OK my question is I am thinking about using gparted to resize / and add more space to /swap but since creating a file with dd looks so easy
I want to know if the swap created with dd command behaves the same way as the swap created on a specific partition? I mean the same performance?

what is your recommendation?

thanks

Last edited by kopper; 08-29-2011 at 07:37 PM..
# 2  
Old 08-29-2011
If they're all on the same spindle anyway, none of them is really 'better'. Creating a big blank file with dd is probably the safest, no partition editing involved, unless someone decides to delete the big "useless" file.

Ideally you want swap on a separate disk, so that use of swap doesn't impact other disk performance.
This User Gave Thanks to Corona688 For This Post:
# 3  
Old 08-29-2011
got it

right now swap is in /dev/sda1
and / is /dev/sda2 same LUN from Storage.

so creating a file under / like /SwapFile is the same thing and safer as you say

thanks a lot

---------- Post updated at 09:25 PM ---------- Previous update was at 07:12 PM ----------

last question since this file will be under /

I know I can used chmod 600 to secure the file

can chattr be used as well?
chattr +i swapfile

Last edited by kopper; 08-29-2011 at 10:39 PM..
# 4  
Old 08-29-2011
Quote:
Originally Posted by kopper
got it

right now swap is in /dev/sda1
and / is /dev/sda2 same LUN from Storage.

so creating a file under / like /SwapFile is the same thing and safer as you say

thanks a lot

---------- Post updated at 09:25 PM ---------- Previous update was at 07:12 PM ----------

last question since this file will be under /

I know I can used chmod 600 to secure the file

can chattr be used as well?
chattr +i swapfile
chattr +i would mark the file immutable meaning even root can't write to it. That would not work for a swapfile which needs to be written to.
This User Gave Thanks to jmesker For This Post:
# 5  
Old 08-29-2011
Quote:
Originally Posted by jmesker
chattr +i would mark the file immutable meaning even root can't write to it. That would not work for a swapfile which needs to be written to.
mmm I was thinking i option was to avoid the file to be deleted

but I just deleted I chattr +i file

and I cannot vi on it well chmod 600 will be

thanks a lot
# 6  
Old 09-01-2011
Quote:
Originally Posted by kopper
got it

right now swap is in /dev/sda1
and / is /dev/sda2 same LUN from Storage.

so creating a file under / like /SwapFile is the same thing and safer as you say
sda1 and sda2 are on the same disk. You aren't gaining anything by putting it on sda1 vs sda2, just put it where you have lots of available space...
This User Gave Thanks to Corona688 For This Post:
# 7  
Old 09-01-2011
although i personally have never tested it, i have been told swap partitions work better than swap files.
Creating a swap partition is no more difficult than creating a swap file with dd
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Unrecognized option: sparc-sun-Solaris2.10/bin/as: unrecognized option `-m32'

Hi, I installed some packages required by an app built with python. But when I try python setup.py install, I get the following error: /opt/csw/lib/gcc/sparc-sun-solaris2.10/5.2.0/../../../../sparc-sun-solaris2.10/bin/as: unrecognized option `-m32' Could anyone tell me what's wrong... (4 Replies)
Discussion started by: Kimkun
4 Replies

2. Solaris

Explain the output of swap -s and swap -l

Hi Solaris Folks :), I need to calculate the swap usage on solaris server, please let me understand the output of below swap -s and swap -l commands. $swap -s total: 1774912k bytes allocated + 240616k reserved = 2015528k used, 14542512k available $swap -l swapfile dev swaplo... (6 Replies)
Discussion started by: seenuvasan1985
6 Replies

3. Shell Programming and Scripting

recently introduced to the newer option for find...does an older option exist?

To find all the files in your home directory that have been edited in some way since the last tar file, use this command: find . -newer backup.tar.gz Is anyone familiar with an older solution? looking to identify files older then 15mins across several directories. thanks, manny (2 Replies)
Discussion started by: mr_manny
2 Replies

4. HP-UX

Swap device file and swap sapce

Hi I have an integrity machine rx7620 and rx8640 running hp-ux 11.31. I'm planning to fine tune the system: - I would like to know when does the memory swap space spill over to the device swap space? - And how much % of memory swap utilization should be specified (swap space device... (6 Replies)
Discussion started by: lamoul
6 Replies

5. Red Hat

swap not defined as swap

free -m : 1023 total swap space created default partition /dev/sdb1 50M using fdisk. i did write the changes. #mkswap /dev/sdb1 #swapon /dev/sdb1 free -m : 1078 total swap space this shows that the swap is on Question : i did not change the type LINUX SWAP (82) in fdisk. so why is... (5 Replies)
Discussion started by: dplinux
5 Replies

6. HP-UX

How much Swap is too much?

I have a HP-UX B.11.23 server with 16 gb of memory 84 gb of swap configured. I am being pushed to define more swap to try and get more Tuxedo domains to start. At what point do we have too much swap for the amount of memory? Thanks in advance. (11 Replies)
Discussion started by: scotbuff
11 Replies

7. Shell Programming and Scripting

option followed by : taking next option if argument missing with getopts

Hi all, I am parsing command line options using getopts. The problem is that mandatory argument options following ":" is taking next option as argument if it is not followed by any argument. Below is the script: while getopts :hd:t:s:l:p:f: opt do case "$opt" in -h|-\?)... (2 Replies)
Discussion started by: gurukottur
2 Replies

8. Solaris

Swap config - Mirror swap or not?

Hello and thanks in advance. I have a Sun box with raid 1 on the O/S disks using solaris svm. I want to unmirror my swap partition, and add the slice on the second disk as an additional swap device. This would give me twice as much swap space. I have been warned not to do this by some... (3 Replies)
Discussion started by: BG_JrAdmin
3 Replies

9. Solaris

swap -l

When i try to type swap -l ,nothing come out but blinking. May i know what is the problem and solutions ? thanks (6 Replies)
Discussion started by: Farbegas
6 Replies

10. UNIX for Dummies Questions & Answers

About swap

Is it really so that if swap will be located in the begining of hard drive, than it will work faster? (1 Reply)
Discussion started by: Ty3
1 Replies
Login or Register to Ask a Question