From owner-freebsd-questions@FreeBSD.ORG Sun Feb 4 20:45:15 2007 Return-Path: X-Original-To: questions@freebsd.org Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6C38816A400 for ; Sun, 4 Feb 2007 20:45:15 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.freebsd.org (Postfix) with ESMTP id 08C1C13C48D for ; Sun, 4 Feb 2007 20:45:14 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from phobos.samsco.home (phobos.samsco.home [192.168.254.11]) (authenticated bits=0) by pooker.samsco.org (8.13.4/8.13.4) with ESMTP id l14KGpCL029474; Sun, 4 Feb 2007 13:16:56 -0700 (MST) (envelope-from scottl@samsco.org) Message-ID: <45C63F25.1070109@samsco.org> Date: Sun, 04 Feb 2007 13:16:37 -0700 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.2pre) Gecko/20070111 SeaMonkey/1.1 MIME-Version: 1.0 To: Aloha Guy References: <773743.47815.qm@web53612.mail.yahoo.com> In-Reply-To: <773743.47815.qm@web53612.mail.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (pooker.samsco.org [168.103.85.57]); Sun, 04 Feb 2007 13:16:56 -0700 (MST) X-Spam-Status: No, score=-1.4 required=3.8 tests=ALL_TRUSTED autolearn=failed version=3.1.1 X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on pooker.samsco.org Cc: questions@freebsd.org, current@freebsd.org Subject: Re: swap file vs swap partition X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Feb 2007 20:45:15 -0000 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