swap file vs swap partition

Aloha Guy alohaguy123 at yahoo.com
Sun Feb 4 21:53:15 UTC 2007


Thanks for the input.  You do have good points.  The only issue with swap partitions is that it seems like you need to increase it everytime you increase the physical memory.  Is there a swap partition size limit that pretty much will handle anything and setting a number larger than that will really not offer anything?

John

----- Original Message ----
From: Scott Long <scottl at samsco.org>
To: Aloha Guy <alohaguy123 at yahoo.com>
Cc: questions at freebsd.org; current at freebsd.org
Sent: Sunday, February 4, 2007 12:16:37 PM
Subject: Re: swap file vs swap partition


Aloha Guy wrote:
> Greetings everyone:
> 
> I am planning to build a few new boxes which will run -RELEASE and -CURRENT and I have a question about the swap file.  In the past, I had always used a swap partition of 256MB since I originally had 128MB system memory in the 1990's but my system has been upgraded to 2GB and it seems the swap file would have more flexibility as I can just change the size of the swapfile if I needed to. My question is is there any difference in performance between a swap file versus a swap partition and can one run a system with a swap file instead of a swap partition?

Yes.  A swap file requires a pass through the filesystem code in order
to figure out where each block is.

> Also, searching has not gotten me very far but are there any drawbacks to a swap file instead of a swap partition?  I read somewhere that a few people seem to think that a swap file can't handle kernel crash dumps?

That's correct, it cannot.

> Shouldn't it be the same as both of them occupy disk space and as long as the swap file is large enough, wouldn't it work?

The crashdump code is written to assume that the dump space is
completely contiguous, something that is not at all guaranteed by
a swap file.  While it would certainly be possible to modify it
to make a pass through the filesystem like above, the intention
of the crashdump code is also to be as simple as possible and to
depend on as few kernel services as possible.  When the system has
crashed, who knows what can be trusted anymore, right?  Also, filesystem
corruption is a frequent cause of crashes; why risk that dumping to
a swapfile might encounter corruption and trash your entire filesystem.

Scott


 
____________________________________________________________________________________
Get your own web address.  
Have a HUGE year through Yahoo! Small Business.
http://smallbusiness.yahoo.com/domains/?p=BESTDEAL


More information about the freebsd-questions mailing list