Subject: bug#5918: [dd] conv=sparse option

From: "H. Langos" <[email-masked]>
Date: Tue, 13 Apr 2010 12:30:47 +0200

On Sat, Apr 10, 2010 at 06:46:13PM +0200, Samuel Thibault wrote:
> Pádraig Brady, le Sat 10 Apr 2010 16:33:07 +0100, a écrit :
> > On 10/04/10 01:28, Heinrich Langos wrote:
> > > a) "dd" will maintain an existing of=target file including the inode 
> > >    number, thus respecting existing hard links. "cp" will depending 
> > >    on the other options given (e.g. "-a") maintain or break existing 
> > >    hard links to an existing target file.
> > 
> > I don't think that's possible as holes can only be created at the end of a file.
> > Well I think NTFS supports punching holes in the "middle" but it's not common.
 
I was not advocating support for punching hole in existing files (though
this is what I want to do in the end).

I was only interested in an option that would create sparse output files by
seeking forward in the output file whenever zero bytes in the input stream
ocurr. This is completely independent of the filesystem underneath. It
should even work if the FS doesn't support holes at all, as long as the 
interface is POSIX compliant.

> I believe there's demand for supporting punching holes in the middle
> of files and it will eventually show up in Linux. For instance, the
> combination of IDE TRIM support and virtualization can allow virtualized
> guest to take as less disk space as possible in file-backed virtual
> disks.

True. "Thin Provisioning", that is the usage of disk images that start out
by allocating only the used disk blocks and growing on demand, suffers from
the inability of guest systems to "give back" unused blocks whenever a block
is released. There are ways around it, but none of them work very well with 
a life guest.

The question there is wether this is a task for "dd" or for a specialized
tool.

-henrik