On Thu, Aug 25, 2011 at 09:37:04AM -0400, Michael Stone wrote:

> My advice is to not use dd unless you really need reblocking, are
> working with tapes, etc. For the requirement above, this is probably
> quicker and easier: truncate -s 500M file.img

No: truncate leaves holes. If you're creating a filesystem on a file, it
means that you can get ENOSPACE even if there would be space in the
file, but because the underlying file system ran out of space when
allocating a block to fill a hole.

In order to avoid that, you have to fill the image file properly right
from the start to get the space actually allocated. I can't think of
anything commonly available besides dd that can do that with large
enough block sizes to make creating the file reasonably efficient. That
is, "head -c 500M" will do it, but not efficiently.


Ciao,

Enrico

-- 
GPG key: 4096R/E7AD5568 2009-05-08 Enrico Zini <[email protected]>

Attachment: signature.asc
Description: Digital signature

Reply via email to