bug-ddrescue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-ddrescue] bug/feature request: sparse file to block device


From: Steven Noonan
Subject: [Bug-ddrescue] bug/feature request: sparse file to block device
Date: Mon, 24 Sep 2012 00:21:55 -0700

It seems that ddrescue doesn't like using -S with block device output
targets. My use case is copying a sparse file (QEMU raw disk image)
onto an empty physical volume. I'd like to avoid doing 'dd
if=sparsefile of=/dev/sdf' because zeros from the sparse file will be
written to the target.


ddrescue doesn't seem to like the idea:

$ sudo ddrescue-1.16/ddrescue -vfDS sparsefile /dev/sdf

ddrescue: Output file exists and is not a regular file.
ddrescue: Only regular files can be sparse.
Try 'ddrescue-1.16/ddrescue --help' for more information.



But if I disable the check that complains:

--- main.cc.old 2012-09-24 07:16:21.872019626 +0000
+++ main.cc 2012-09-24 07:16:29.084426701 +0000
@@ -187,7 +187,7 @@
   if( min_outfile_size > 0 || !force || preallocate || sparse )
     {
     struct stat st;
-    if( stat( oname, &st ) == 0 && !S_ISREG( st.st_mode ) )
+    if( stat( oname, &st ) == 0 && !S_ISREG( st.st_mode )  && 0)
       {
       show_error( "Output file exists and is not a regular file." );
       if( !force )



It seems to function correctly:

$ time sudo ddrescue-1.16/ddrescue -vfDS sparsefile /dev/sdf


GNU ddrescue 1.16
About to copy 8589 MBytes from sparsefile to /dev/sdf
    Starting positions: infile = 0 B,  outfile = 0 B
    Copy block size: 128 sectors       Initial skip size: 128 sectors
Sector size: 512 Bytes

Press Ctrl-C to interrupt
rescued:     8589 MB,  errsize:       0 B,  current rate:   53739 kB/s
   ipos:     8589 MB,   errors:       0,    average rate:     190 MB/s
   opos:     8589 MB,     time since last successful read:       0 s
Finished

real 0m44.074s
user 0m6.352s
sys 0m4.192s
$

I've checked that the resulting /dev/sdf looks correct, and it seems
sane. What am I missing here?

- Steven



reply via email to

[Prev in Thread] Current Thread [Next in Thread]