From owner-freebsd-stable Mon May 25 08:34:44 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id IAA06016 for freebsd-stable-outgoing; Mon, 25 May 1998 08:34:44 -0700 (PDT) (envelope-from owner-freebsd-stable@FreeBSD.ORG) Received: from fledge.watson.org (root@COPLAND.CODA.CS.CMU.EDU [128.2.222.48]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id IAA05992 for ; Mon, 25 May 1998 08:34:27 -0700 (PDT) (envelope-from robert@cyrus.watson.org) Received: from fledge.watson.org (robert@fledge.pr.watson.org [192.0.2.3]) by fledge.watson.org (8.8.8/8.8.8) with SMTP id LAA12277 for ; Mon, 25 May 1998 11:34:27 -0400 (EDT) Date: Mon, 25 May 1998 11:34:27 -0400 (EDT) From: Robert Watson X-Sender: robert@fledge.watson.org Reply-To: Robert Watson To: stable@FreeBSD.ORG Subject: vnconfig + swap with sparse files Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk I recently had to move my swap space from a hard disk rapidly failing to a file on another partition (until the drive can be replacd). As there were no free partitions, the easiest route seemed to be to use a swapfile (although I'm not sure what the performance costs are). However, I assumed (correctly?) that I'd need to size the file to the right size so that the it would be known at vnconfig time, so I stuck together an instance C program that lseek'd to the appropriate size (128M), then wrote a \0 there. This, of course, creates a sparse file which returns 0's normally whenever you seek to an unused portion of the file, but doesn't consume disk space until you write to it. The swap pager began complaining almost immediately after I turned on the swapfile. A few sample error messages are attached: May 24 16:17:16 fledge /kernel: swap_pager: I/O error - async pageout failed; blkno 144, size 8192, error 0 May 24 16:17:16 fledge /kernel: swap_pager_finish: I/O error, clean of page 5757000 failed May 24 16:17:17 fledge /kernel: swap_pager_finish: I/O error, clean of page 56d8000 failed May 24 16:17:17 fledge /kernel: swap_pager: I/O error - async pageout failed; blkno 144, size 8192, error 0 May 24 16:17:17 fledge /kernel: swap_pager_finish: I/O error, clean of page 5757000 failed May 24 16:17:17 fledge /kernel: swap_pager_finish: I/O error, clean of page 56d8000 failed May 24 16:17:17 fledge /kernel: swap_pager: I/O error - async pageout failed; blkno 192, size 4096, error 0 I rebooted to stop swapping on the file, and modified my creation program to drop a \0 at the beginning of each block. Sure enough, starting swapping this time worked fine. While I managed to figure it out, the error message was not all that enlightening. It does make sense not to try and use a sparse file as the backing store (after all, that a sparse file claims to be 100mb is not a guarantee that the space will be available). Maybe vnconfig should notice when a file is sparse and warn the user? swapon might not be able to tell as it just sees it as vn0b, though. Or maybe the sparseness of the file should just be transparent as it is elsewhere? Robert N Watson ---- Carnegie Mellon University http://www.cmu.edu/ Trusted Information Systems http://www.tis.com/ SafePort Network Services http://www.safeport.com/ robert@fledge.watson.org http://www.watson.org/~robert/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message