swap to a sparse file
Steve O'Hara-Smith
steve at sohara.org
Sat Oct 13 14:19:39 UTC 2018
On Sat, 13 Oct 2018 14:52:47 +0100
RW via freebsd-questions <freebsd-questions at freebsd.org> wrote:
> On Sat, 13 Oct 2018 08:11:18 +0100
> Steve O'Hara-Smith wrote:
>
> > On Fri, 12 Oct 2018 19:36:33 +0100
> > RW via freebsd-questions <freebsd-questions at freebsd.org> wrote:
> >
> > > On Thu, 11 Oct 2018 08:51:14 +0100
> > > Steve O'Hara-Smith wrote:
> > >
> > > > On Thu, 11 Oct 2018 08:47:05 +0700
> > > > Victor Sudakov <vas at mpeks.tomsk.su> wrote:
> > > >
> > > > > Is there any good reason I can't just "truncate -s2G /swap0" and
> > > > > make the swap a sparse file?
> > > >
> > > > Just one - if the space isn't there when the system needs
> > > > it there will be a panic.
> > >
> > > Is that really the only reason? I've not paid much attention, but
> > > the warnings I've heard about this have made it sound a lot worse.
> >
> > There's not much worse the system can do than panic, other
> > than deadlock which might happen if memory needs to be allocated in
> > order to add blocks to the file. IIRC swap on a zvol can deadlock
> > that way.
>
>
> Yes, but filling up a drive is relatively avoidable - particularly if
> there's space reserved for root.
True enough, although if you are counting on having the space
available then pre-allocating it is a strong guarantee and prevents the
performance penalty of adding a block to a file as an overhead of swapping.
--
Steve O'Hara-Smith <steve at sohara.org>
More information about the freebsd-questions
mailing list