From owner-freebsd-questions@freebsd.org Sat Oct 13 14:19:39 2018 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 316FD10CB6A2 for ; Sat, 13 Oct 2018 14:19:39 +0000 (UTC) (envelope-from 4250.10.freebsd-questions=freebsd.org@email-od.com) Received: from s1-b0c6.socketlabs.email-od.com (s1-b0c6.socketlabs.email-od.com [142.0.176.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CD6577C60A for ; Sat, 13 Oct 2018 14:19:38 +0000 (UTC) (envelope-from 4250.10.freebsd-questions=freebsd.org@email-od.com) DKIM-Signature: v=1; a=rsa-sha256; d=email-od.com;i=@email-od.com;s=dkim; c=relaxed/relaxed; q=dns/txt; t=1539440379; x=1542032379; h=content-transfer-encoding:content-type:mime-version:references:in-reply-to:message-id:subject:cc:to:from:date:x-thread-info; bh=j2Xo10QhxG2q+3yonoB0hj8ofIo2vTP3QI0GQSBEz60=; b=JY0xFotZePLWpE1KA0QfAkZz2X4PIK5i8TCvuo0g24xubD2hnm1FxWyc4srG2ZFomzw3GqER/mThvlx4L3WvdWSkC7tnjfKKVgn6TjR45b45XklYPVPilJnv1wgYEliw56McfwIAt5/OXsg5f1ki2BmV4Xurumen1XJcGUpNnAw= X-Thread-Info: NDI1MC4xMi4xOWQwMDAwMDAzYjA5YTUuZnJlZWJzZC1xdWVzdGlvbnM9ZnJlZWJzZC5vcmc= Received: from r2.us-east.aws.in.socketlabs.com (r2.us-east.aws.in.socketlabs.com [54.85.171.149]) by mxsg2.email-od.com with ESMTP(version=Tls12 cipher=Aes256 bits=256); Sat, 13 Oct 2018 10:19:27 -0400 Received: from smtp.lan.sohara.org (EMTPY [89.127.62.20]) by r2.us-east.aws.in.socketlabs.com with ESMTP(version=Tls12 cipher=Aes256 bits=256); Sat, 13 Oct 2018 10:19:27 -0400 Received: from [192.168.63.1] (helo=steve.lan.sohara.org) by smtp.lan.sohara.org with smtp (Exim 4.91 (FreeBSD)) (envelope-from ) id 1gBKlI-0009BI-B0; Sat, 13 Oct 2018 15:19:24 +0100 Date: Sat, 13 Oct 2018 15:19:23 +0100 From: Steve O'Hara-Smith To: freebsd-questions@freebsd.org Cc: RW Subject: Re: swap to a sparse file Message-Id: <20181013151923.edca08f54b508dc98b91cb37@sohara.org> In-Reply-To: <20181013145247.0a4b7f05@gumby.homeunix.com> References: <20181011014705.GA17798@admin.sibptus.ru> <20181011085114.bfcdb701b3644728a71eaa38@sohara.org> <20181012193633.7dc32f86@gumby.homeunix.com> <20181013081118.9e8632405e555c3bf2f9a722@sohara.org> <20181013145247.0a4b7f05@gumby.homeunix.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd11.1) X-Clacks-Overhead: "GNU Terry Pratchett" Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Oct 2018 14:19:39 -0000 On Sat, 13 Oct 2018 14:52:47 +0100 RW via freebsd-questions 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 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 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