[Forensics-changes] [SCM] recover files/disks with damaged sectors branch, debian, updated. debian/0.19-2-4-g1192f2d

Daniel Baumann daniel at debian.org
Sat Jan 10 19:49:48 UTC 2009


The following commit has been merged in the debian branch:
commit b22262768f01c06610b5949bb2e93e061710c646
Author: Daniel Baumann <daniel at debian.org>
Date:   Sat Jan 10 20:40:00 2009 +0100

    Merging upstream version 0.20.

diff --git a/Makefile b/Makefile
index b0f8cfb..b10e6dc 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-VERSION=0.19
+VERSION=0.20
 
 CFLAGS=-Wall -Wshadow -Wconversion -Wwrite-strings -Winline -O2 -DVERSION=\"$(VERSION)\"
 LDFLAGS=
@@ -10,13 +10,14 @@ all: recoverdm mergebad
 
 recoverdm: $(OBJSr)
 	$(CC) -Wall -W $(OBJSr) $(LDFLAGS) -o recoverdm
-	strip recoverdm
-	echo
-	echo Oh, blatant plug: http://keetweej.vanheusden.com/wishlist.html
 
 mergebad: $(OBJSm)
 	$(CC) -Wall -W $(OBJSm) $(LDFLAGS) -o mergebad
-	strip mergebad
+
+install:
+	cp recoverdm mergebad /usr/local/bin
+	echo
+	echo Oh, blatant plug: http://keetweej.vanheusden.com/wishlist.html
 
 clean:
 	rm -f $(OBJSr) $(OBJSm) recoverdm mergebad core
diff --git a/recoverdm.1 b/recoverdm.1
index 90fd7b3..e69de29 100644
--- a/recoverdm.1
+++ b/recoverdm.1
@@ -1,52 +0,0 @@
-.TH RECOVERDM 1 "Version 0.19 " "recoverdm"
-
-.SH NAME
-recoverdm \- recover files\/disks with damaged sectors
-
-.SH SYNOPSIS
-.I recoverdm
-\-t type \-i file\/devicein \-o fileout [\-l list] [\-n retries] [\-s speed]
-.SH DESCRIPTION
-.LP
-.I recoverdm
-This program will help you recover disks with bad sectors. You can recover files as well complete devices.
-In case if finds sectors which simply cannot be recoverd, it writes an empty sector to the outputfile and continues.
-If you're recovering a CD or a DVD and the program cannot read the sector in "normal mode",
-then the program will try to read the sector in "RAW mode" (without error-checking etc.).
-This toolkit also has a utility called 'mergebad': mergebad merges multiple images into one.
-This can be usefull when you have, for example, multiple CD's with the same data which are all damaged.
-In such case, you can then first use recoverdm to retrieve the data from the damaged CD's into image-files and then combine them into one image with mergebad.
-.SH OPTIONS
-.TP
-.I "\-t type"
-is 1 for files, 10 for floppy disks and 40 for IDE disks (try -h for a complete list)
-.TP
-.I "\-i file\/devicein"
-is the device or file you want to recover.
-.TP
-.I "\-o fileout"
-is the file where to write to. This file should not already exists.
-.TP
-.I "\-l list"
-This file will contain the offsets of the bad blocks as well as the size of the badblocks.
-This file can be used together with the image with the mergebad utility.
-.TP
-.I "\-n retries"
-Number of retries before going on with next sector, defaults to 6.
-.TP
-.I "\-r RAW read"
-Number of retries while reading in RAW mode before going on with next sector, default to 6.
-.TP
-.I "\-s rotation speed"
-Speed of the CD\-ROM\/DVD, defaults to 1.
-.TP
-.I "\-h"
-Gives the help message.
-
-.SH SEE ALSO
-gddrescue(1), dd_rescue(1), testdisk(1), gpart(1)
-
-.SH AUTHOR
-Folkert van Heusden <flok at xs4all.nl>,
-.br
-Home page is <http://www.vanheusden.com/recoverdm/>
diff --git a/recoverdm.c b/recoverdm.c
index dcb64b1..8b71ae1 100644
--- a/recoverdm.c
+++ b/recoverdm.c
@@ -26,10 +26,12 @@ void usage(void)
 {
 	fprintf(stderr, "Usage: recoverdm -t <type> -i <file/device-in> -o <fileout> [-l <sectorsfile>] [-n # retries]\n");
 	fprintf(stderr, "                 [-s rotation speed (CD-ROM etc.)] [-r # CD/DVD RAW read retries]\n");
-	fprintf(stderr, "                 [-b start offset]\n");
+	fprintf(stderr, "                 [-b start offset] [-p skip blocks count]\n");
 	fprintf(stderr, "Number of retries defaults to %d. For CD-ROMs it's advised to use 1.\n", N_RETRIES);
 	fprintf(stderr, "Number of CD/DVD RAW read retries defaults to %d. It is advised to use at least 3.\n", N_CD_RAW_RETRIES);
 	fprintf(stderr, "CD-ROM (and DVD) speed defaults to %d.\n", DEFAULT_CD_SPEED);
+	fprintf(stderr, "Skip blocks count is how many sectors are skipped after non-read one. Use\n");
+	fprintf(stderr, "more to speed-up the recover process. Default is 1.\n");
 	fprintf(stderr, "Type can be:\n");
 	fprintf(stderr, "\tFILE\t\t1\n");
 	fprintf(stderr, "\tFLOPPY\t\t10\n");
@@ -206,6 +208,7 @@ int main(int argc, char *argv[])
 	int fdin, fdout;
 	off64_t prevpos, curpos=(off64_t)-1, lastok=(off64_t)-1, the_end;
 	off64_t start_offset = 0;
+	int skip_value = 1; // in blocks
 	int n=0;
 	size_t block_size;
 	int c;
@@ -224,7 +227,7 @@ int main(int argc, char *argv[])
 		return -1;
 	}
 
-	while((c = getopt(argc, argv, "i:o:l:t:n:s:r:b:Vh")) != -1)
+	while((c = getopt(argc, argv, "i:o:l:t:p:n:s:r:b:Vh")) != -1)
 	{
 		switch(c)
 		{
@@ -252,6 +255,9 @@ int main(int argc, char *argv[])
 		case 'n':
 			n_retries = atoi(optarg);
 			break;
+		case 'p':
+			skip_value = atoi(optarg);
+			break;
 		case 's':
 			cd_speed = atoi(optarg);
 			break;
@@ -284,6 +290,12 @@ int main(int argc, char *argv[])
 		fprintf(stderr, "Start offset must be a multiple of 512!\n");
 		return -1;
 	}
+	
+	if (skip_value <= 0)
+	{
+		fprintf(stderr, "Skip value must be positive!\n");
+		return -1;
+	}
 
 	if (dev_type == DT_CDROM_IDE || dev_type == DT_CDROM_SCSI)
 		block_size = 2048;
@@ -430,7 +442,7 @@ int main(int argc, char *argv[])
 				/* always mark the sector as tricky */
 				if (dsecfile)
 				{
-					fprintf(dsecfile, "%lld %ld\n", curpos, block_size);
+					fprintf(dsecfile, "%lld %ld\n", curpos, block_size*skip_value);
 					fflush(dsecfile);
 				}
 
@@ -462,11 +474,11 @@ int main(int argc, char *argv[])
 					}
 				}
 
-				printf("Tried reading %d times, failed doing that. Continuing...\n", n_retries);
+				printf("Tried reading %d times, failed doing that. Skiping %d blocks...\n", n_retries, skip_value);
 
-				if (lseek64(fdin, curpos + (off64_t)block_size, SEEK_SET) == -1)
+				if (lseek64(fdin, curpos + (off64_t)block_size*skip_value, SEEK_SET) == -1)
 				{
-					fprintf(stderr, "Problem seeking in input-file! [%d] (next sector)\n", errno);
+					fprintf(stderr, "Problem seeking in input-file! [%d] (sector %d after current)\n", errno, skip_value);
 				}
 			}
 		}

-- 
recover files/disks with damaged sectors



More information about the forensics-changes mailing list