Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 May 1998 11:34:27 -0400 (EDT)
From:      Robert Watson <robert@cyrus.watson.org>
To:        stable@FreeBSD.ORG
Subject:   vnconfig + swap with sparse files
Message-ID:  <Pine.BSF.3.96.980525112157.12110A-100000@fledge.watson.org>

next in thread | raw e-mail | index | archive | help


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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.980525112157.12110A-100000>