Swap which option is better


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Swap which option is better
# 8  
Old 09-01-2011
Quote:
Originally Posted by Tommyk
although i personally have never tested it, i have been told swap partitions work better than swap files.
Again, the benefit happens when swap is on a different disk, not just a different partition..
# 9  
Old 09-01-2011
https://lkml.org/lkml/2005/7/7/326

See andrew Morton's comment on question 2.
Quote:
> 2. Is it possible for the swapfile to become fragmented over time, or
> does it just keep using the same blocks over and over? i.e. if it's
> all contiguous when you first create the swapfile, will it stay that
> way for the life of the file?

The latter. Create the swapfile when the filesystem is young and empty,
it'll be nice and contiguous. Once created the kernel will never add or
remove blocks. The kernel won't let you use a sparse file for a swapfile.
Just food for thought Smilie
# 10  
Old 09-01-2011
Large files created whole by dd ought to be contiguous anyway. I continue to consider it a nonissue -- especially when there's already much bigger problems caused by having it on the same disk at all.
# 11  
Old 09-01-2011
Quote:
Originally Posted by Corona688
Large files created whole by dd ought to be contiguous anyway.
I agree, when You have fresh filesystem...
But what when it's physicaly impossible? Eg. sda1 was up to 99% used, then You moved/deleted some files, and then You create Your swapfile on that sda1.
In this case file could be spread over whole disk. And this will have an influence on efficiency. Ain't I right?
But with swap partition You are _sure_ that all swap is really continuous, in one place.
That's how I see this Smilie Please tell me if I'm wrong.
# 12  
Old 09-01-2011
Quote:
Originally Posted by sulti
I agree, when You have fresh filesystem...
But what when it's physicaly impossible? Eg. sda1 was up to 99% used, then You moved/deleted some files, and then You create Your swapfile on that sda1.
In this case file could be spread over whole disk. And this will have an influence on efficiency. Ain't I right?
Swap is random-access by definition. Using it will thrash your disk like a wounded moth no matter how contiguous your swapfile is, fragmentation can't really make that worse. The overhead is simply the usual overhead of using a file at all.

While it's busy thrashing like that, a disk has a difficult time doing anything else, which is the real problem in putting your swap on the same drive as your files.
 
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