|
From: | Antonio Diaz Diaz |
Subject: | Re: [Bug-ddrescue] Preallocating space, if possible |
Date: | Mon, 14 Jun 2010 21:13:28 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.7.11) Gecko/20050905 |
Hello Matthew, Matthew Ruffalo wrote:
First, thank you for the wonderful tool. I've used ddrescue many times to recover data from failing hard drives, as well as for manually imaging working drives (the progress/speed display is very nice).
:-)
I'm curious whether it's possible for ddrescue to preallocate space for the file that it writes using posix_fallocate.
I think this is a very useful idea. Even on systems where size information is not available at all, user can tell ddrescue the size to copy, and this size can be preallocated. I expect I'll be able to implement it in 1.13.
I did a quick grep through the source code and didn't find any instance of 'allocate'. My understanding (which is not all that likely to be correct) is that this behavior is distinct from the --sparse option. A sparse file's size is reported to be much larger than the allocated size on disk, whereas the new behavior would tell the filesystem in advance that e.g. the image file will eventually contain 250GB. The filesystem will then allocate this space as contiguously as possible.
I suspect preallocation may prevent the creation of sparse files on some sytems, so I plan to add a --preallocate option. See for example http://www.linux-mag.com/id/7272/2/
"The fallocate() system call is not in most glibc's as of this writing, but posix_fallocate() is; the problem with posix_fallocate is that if you use it on ext3, it will attempt to emulate fallocate() by writing all zeros to the file".
Semi-related question: is there a publicly accessible source code repository for ddrescue? I created a repository on GitHub ( http://github.com/mruffalo/ddrescue ) that I will use to publish my changes in the event that I implement this feature myself.
I work on a computer without internet connection, so I have not created a public repository for ddrescue. Thanks for creating one.
Best regards, Antonio.
[Prev in Thread] | Current Thread | [Next in Thread] |