Next: , Previous:   [Index]


11 Direct disc access

If you notice that the positions and sizes in mapfile are always multiples of the sector size, maybe your kernel is caching the disc accesses and grouping them. In this case you may want to use direct disc access for infile, or read from a raw device, to bypass the kernel cache and rescue more of your data.

NOTE! Sector size must be correctly set with the option --sector-size for direct disc access to work.

NOTE: Direct disc access can copy arbitrary domains by reading whole sectors and then writing only the requested part. This is the only case where ddrescue will try to read data outside the rescue domain.

Try the option --idirect first. If direct disc access is not available in your system, try raw devices. Read your system documentation to find how to bind a raw device to a regular block device. Some OSs provide raw access through especial device names, like /dev/rdisk.

Ddrescue aligns its I/O buffer to the sector size so that it can be used for direct disc access or to read from raw devices. For efficiency reasons, also aligns it to the memory page size if page size is a multiple of sector size. On some systems, ddrescue can’t determine the size of a raw device, so an explicit --size or --complete-only option may be needed.

Using direct disc access, or reading from a raw device, may be slower or faster than normal cached reading depending on your OS and hardware. In case it is slower you may want to make a first pass using normal cached reads and use direct disc access, or a raw device, only to recover the good sectors inside the failed blocks.


Example 1: using direct disc access.

ddrescue -f -n /dev/sdb1 /dev/sdc1 mapfile
ddrescue -d -f -r3 /dev/sdb1 /dev/sdc1 mapfile
e2fsck -v -f /dev/sdc1
mount -t ext2 -o ro /dev/sdc1 /mnt

Example 2: using a raw device.

raw /dev/raw/raw1 /dev/sdb1
ddrescue -f -n /dev/sdb1 /dev/sdc1 mapfile
ddrescue -C -f -r3 /dev/raw/raw1 /dev/sdc1 mapfile
raw /dev/raw/raw1 0 0
e2fsck -v -f /dev/sdc1
mount -t ext2 -o ro /dev/sdc1 /mnt

Next: Copying parts of the input file on demand, Previous: A small tutorial with examples   [Index]