From owner-freebsd-hackers@FreeBSD.ORG Sat Jun 16 13:07:15 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7BFFC1065670 for ; Sat, 16 Jun 2012 13:07:15 +0000 (UTC) (envelope-from pieter@degoeje.nl) Received: from smtp.utwente.nl (smtp1.utsp.utwente.nl [130.89.2.8]) by mx1.freebsd.org (Postfix) with ESMTP id D98D48FC16 for ; Sat, 16 Jun 2012 13:07:14 +0000 (UTC) Received: from nox.student.utwente.nl (nox.student.utwente.nl [130.89.165.91]) by smtp.utwente.nl (8.12.10/SuSE Linux 0.7) with ESMTP id q5GCxmeY032164; Sat, 16 Jun 2012 14:59:48 +0200 From: Pieter de Goeje To: freebsd-hackers@freebsd.org Date: Sat, 16 Jun 2012 14:59:20 +0200 User-Agent: KMail/1.13.7 (Linux/3.2.0-2-amd64; KDE/4.7.4; x86_64; ; ) References: <4FD94240.6060806@delphij.net> In-Reply-To: MIME-Version: 1.0 Message-Id: <201206161459.20596.pieter@degoeje.nl> Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-UTwente-MailScanner-Information: Scanned by MailScanner. Contact icts.servicedesk@utwente.nl for more information. X-UTwente-MailScanner: Found to be clean X-UTwente-MailScanner-From: pieter@degoeje.nl X-Spam-Status: No Cc: Wojciech Puchar , d@delphij.net Subject: Re: BIO_DELETE equivalent for file on FFS filesystem X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jun 2012 13:07:15 -0000 On Thursday 14 June 2012 06:48:14 Wojciech Puchar wrote: > >> file to take 900MB or... can i call some system function to "punch" > >> holes? > > > > I think you can only truncate the file at this time, pretty much like > > brk() works for memory. > > BAD. suppose i keep windoze VM image on filesystem which takes 10GB but > uses 5GB. > > i could write simple program to find out what blocks are unused and > then...do nothing. Actually you can. Use dd if=infile of=outfile conv=sparse to convert a file to a sparse file. This obviously only works on filesystems supporting sparse files, such as UFS. Regards, Pieter