From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 1 17:51:20 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9262216A4E7 for ; Tue, 1 Aug 2006 17:51:20 +0000 (UTC) (envelope-from anderson@centtech.com) Received: from mh2.centtech.com (moat3.centtech.com [207.200.51.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8151543D68 for ; Tue, 1 Aug 2006 17:51:18 +0000 (GMT) (envelope-from anderson@centtech.com) Received: from [10.177.171.220] (neutrino.centtech.com [10.177.171.220]) by mh2.centtech.com (8.13.1/8.13.1) with ESMTP id k71HpG1N040244; Tue, 1 Aug 2006 12:51:16 -0500 (CDT) (envelope-from anderson@centtech.com) Message-ID: <44CF94A4.3000306@centtech.com> Date: Tue, 01 Aug 2006 12:51:32 -0500 From: Eric Anderson User-Agent: Thunderbird 1.5.0.4 (X11/20060612) MIME-Version: 1.0 To: rick-freebsd@kiwi-computer.com References: <44CE03D2.2050803@centtech.com> <17614.4005.407223.621637@bhuda.mired.org> <44CE199C.2020500@centtech.com> <17614.8289.134373.387558@bhuda.mired.org> <96b30c400607310847s1d2f845eo212b234d03f51e9a@mail.gmail.com> <17614.10982.499561.139268@bhuda.mired.org> <20060801072611.GA717@turion.vk2pj.dyndns.org> <20060801171150.GB3413@megan.kiwi-computer.com> <44CF8F1A.5090506@centtech.com> <20060801174048.GE3413@megan.kiwi-computer.com> In-Reply-To: <20060801174048.GE3413@megan.kiwi-computer.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.87.1/1630/Tue Aug 1 10:38:56 2006 on mh2.centtech.com X-Virus-Status: Clean Cc: freebsd-hackers@freebsd.org Subject: Re: [PATCH] adding two new options to 'cp' 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: Tue, 01 Aug 2006 17:51:20 -0000 On 08/01/06 12:40, Rick C. Petty wrote: > On Tue, Aug 01, 2006 at 12:27:54PM -0500, Eric Anderson wrote: >> Wouldn't this be incorrect for files that are really full of zeros? It >> would turn them in to sparse files when they shouldn't be, correct? Is >> that what happens with other tools? > > Why is this bad? I'm not suggesting that the default implementation > should change but that this "-s" option be added to properly optimize > for sparse files. A sparse file is one which contains blocks of pure > zeros. My example wouldn't vary in how the destination file is read > but in how many blocks are allocated in the underlying file system. It could possibly be bad if you have a real file (say a 10GB file, partially filled with zeros - a disk image created with dd for instance), and you use cp with something like -spR to recursively copy all files. Your destination disk image would then be a sparse file, so additional changes and modifications to the file (block allocations) would fragment the image and make it slower. That would be unexpected and probably go unnoticed for some time. I do see the usefulness in this, but I think one needs to be careful to either clearly note in the man page that it will make sparse files from *any* file containing a string of zeros larger than the block size, or it needs to 'do the right thing' and determine if it's sparse or not. Eric -- ------------------------------------------------------------------------ Eric Anderson Sr. Systems Administrator Centaur Technology Anything that works is better than anything that doesn't. ------------------------------------------------------------------------