From owner-freebsd-questions@freebsd.org Thu Oct 11 01:47:07 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 6FA3310C51A0 for ; Thu, 11 Oct 2018 01:47:07 +0000 (UTC) (envelope-from vas@mpeks.tomsk.su) Received: from admin.sibptus.ru (admin.sibptus.ru [IPv6:2001:19f0:5001:21dc:5400:1ff:feaf:6afb]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0A61C7BE82 for ; Thu, 11 Oct 2018 01:47:06 +0000 (UTC) (envelope-from vas@mpeks.tomsk.su) Received: from vas by admin.sibptus.ru with local (Exim 4.91 (FreeBSD)) (envelope-from ) id 1gAQ49-0004eY-4w for freebsd-questions@freebsd.org; Thu, 11 Oct 2018 08:47:05 +0700 Date: Thu, 11 Oct 2018 08:47:05 +0700 From: Victor Sudakov To: freebsd-questions@freebsd.org Subject: swap to a sparse file Message-ID: <20181011014705.GA17798@admin.sibptus.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-PGP-Key: http://www.dreamwidth.org/pubkey?user=victor_sudakov X-PGP-Fingerprint: 10E3 1171 1273 E007 C2E9 3532 0DA4 F259 9B5E C634 User-Agent: Mutt/1.10.1 (2018-07-13) Sender: Victor Sudakov 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: Thu, 11 Oct 2018 01:47:07 -0000 Dear Colleagues, I've inherited a swapless FreeBSD 11.2 host with no unused disk space. I would like to add some swap to be on the safe side: in case there is a memory leak etc. On the other hand, I don't like to waste several gigabytes on a precious SSD because perhaps the system will never need this swap space anyway. The FreeBSD Handbook prescribes creating a swap file with "dd if=/dev/zero ..." which would waste the space. Is there any good reason I can't just "truncate -s2G /swap0" and make the swap a sparse file? Thanks in advance for any input. -- Victor Sudakov, VAS4-RIPE, VAS47-RIPN 2:5005/49@fidonet http://vas.tomsk.ru/