|
From: | Florian Sedivy |
Subject: | Re: [Bug-ddrescue] ddrescue 10x slow under osx |
Date: | Thu, 20 Dec 2012 19:11:50 +0100 |
Hola Antonio, Am 19.12.2012 um 17:42 schrieb Antonio Diaz Diaz:
Probably yes, if "other users" excludes those, who have their first encounter with a shell just after inserting an Emergency-Boot-CD … 8-|
In fact its is BSD's cat. I had a look and the relevant code is: if (fstat(wfd, &sbuf))
err(1, "stdout");
bsize = MAX(sbuf.st_blksize, BUFSIZ); later: read(rfd, buf, bsize) So cat takes st_blksize from stat() and the value of the BUFSIZ macro and uses the bigger one. (cat specifically stats the output and uses the result for both read and write. To find a suitable value for ddrescues purpose, one would rather stat the input file.) The author probably read (or wrote?) http://www.delorie.com/gnu/docs/glibc/libc_226.html :
Enhancement proposal: How about ddrescue determining the default Copy Block Size this way? (Alternatively -c 0 could switch to this "Auto detection", but I doubt anybody would miss the hardcoded 64KiB default.) While fast transfer may not be ddrescue's main purpose, with dying hard drives it's always a race against time. File type, reported stat.st_blksize values and speed effect observed on my system: regular (HFS+) files 4096 always read at maximum speed, regardless of dd(rescue)'s Copy Block Size /dev/disk… block devices 2048 always read slow, regardless of Copy Block Size, as if you were using 4KiB CBS /dev/rdisk… raw character devices 131072 =128KiB, which is in my testing actually the smallest CBS giving maximum speed I don't know the value of BUFSIZ, but stat.st_blksize seems to work better (+15%) or equal than the 64KiB default. The only time when setting a CBS bigger than stat.st_blksize improved speed even further was when I accessed a sparse image that was attached as a device. Why block devices on OS X behave like this, I don't know. As long as they do, however, they should be avoided when using tools like ddrescue. (I also suspect, that with /dev/disk… read errors are always reported in the first sector requested, instead of where they really occurred.)
Documentation proposal: If the results of my testing are general for all OS X operation, then ddrescue's -c --cluster-size option only has an effect at all on OS X, when used with /dev/rdisk… raw character devices. Add the much better speed that can be achieved by using a sensible value for the Copy Block Size together /dev/rdisk… and I think this would be specific enough to advise ddrescue users on OS X to always specify drives and partitions by their /dev/rdisk… descriptor instead of /dev/disk…
I can write some text proposals, If needed. It may be beneficial however, to have a more complete picture (other OS, other opinions) before putting it in words. --------------- I noticed speed differences long ago, found values that worked for me and never investigated any further. Maybe now is the time. Florian |
[Prev in Thread] | Current Thread | [Next in Thread] |