myrescue-0.9.4/0000755000175000001440000000000010664374610014227 5ustar kristofusers00000000000000myrescue-0.9.4/ChangeLog0000644000175000001440000000106310664374146016005 0ustar kristofusers000000000000000.9.4 Added options -F to skip around known bad regions and -G to concentrate around known good regions. Added option -J to randomly jump around. 0.9.3 Fixed error handling of short reads Added -A option to abort on first error 0.9.2 Added -R option to reverse reading direction thanks to Holger Ohmacht Added -f option to skip failed blocks Synced german and english manpages 0.9.1 Added german translation of manpage; thanks to Holger Ohmacht Enhanced english manpage 0.9.0 First beta release myrescue-0.9.4/AUTHORS0000644000175000001440000000014207577155630015304 0ustar kristofusers00000000000000Kristof Koehler Peter Schlaile myrescue-0.9.4/COPYING0000644000175000001440000004313107573734400015266 0ustar kristofusers00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. myrescue-0.9.4/INSTALL0000644000175000001440000000047007577163166015274 0ustar kristofusers00000000000000Installation procedure ====================== ... is currently in a rather poor state. - Compile the binary * Change to the src directory * Type make - Install the binary * Copy the myrescue binary to the destination location, most probably /bin oder /sbin - Install the manpage That's all folks. myrescue-0.9.4/README0000644000175000001440000000036107577155630015117 0ustar kristofusers00000000000000myrescue is a program to rescue the still-readable data from a damaged harddisk. It is similiar in purpose to dd_rescue, but it tries to quickly get out of damaged areas to first handle the not yet damaged part of the disk and return later. myrescue-0.9.4/TODO0000644000175000001440000000015710155675062014722 0ustar kristofusers00000000000000Open Tasks ========== - ./configure && make && make install - Portability - Binary packages for distributions myrescue-0.9.4/doc/0000755000175000001440000000000010664374607015002 5ustar kristofusers00000000000000myrescue-0.9.4/doc/myrescue.10000644000175000001440000001456410664373642016730 0ustar kristofusers00000000000000.\" $Header: /cvsroot/myrescue/doc/myrescue.1,v 1.9 2007/08/26 21:58:58 kristofk Exp $ .TH MYRESCUE "8" "August 2007" "myrescue 0.9.4" "User Commands" .SH NAME myrescue \- Harddisc Rescue .SH SYNOPSIS .B myrescue .RB [ -b .IR block-size ] .RB [ -B .IR bitmap-file ] .RB [ -A ] .RB [ -S ] .RB [ -r .IR retry-count ] .RB [ -f .IR skip-failed ] .RB [ -s .IR start-block ] .RB [ -e .IR end-block ] .RB [ -R ] .RB [ -G .IR good-range ] .RB [ -F .IR failed-range ] .RB [ -J .IR jump-after-blocks ] .I input-file .I output-file .SH DESCRIPTION myrescue is a program to rescue the still-readable data from a damaged harddisk. It is similiar in purpose to dd_rescue, but it tries to quickly get out of damaged areas to first handle the not yet damaged part of the disk and return later. .PP The program tries to copy the device blockwise to a file and keeps a table ("block bitmap") noting whether a block has been successfully copied, not yet handled or has had errors. This block bitmap can be used in successive runs to concentrate on the not yet rescued blocks. .PP The program has a special skip mode to handle read errors. Usually harddisk surface defects cover more than just one block and continuous reading in defect areas can damage the surface, the heads and (by permanent recalibration) the drive mechanics. If this happens, the chances of rescuing the remaining undamaged data drop dramatically. So in skip mode, myrescue tries to get out of damaged areas quickly by exponentially increasing the stepsize. The skipped blocks are marked as unhandled in the block bitmap and can be retried later. .PP Finally, the program has an option to multiply try to read a block before considering it damaged. .SH NOTE .B This tools is no replacement for a professional data recovery service! If you do have the latter option, don't even think of using .BR myrescue , as it may further damage your disk. This tool is provided only for the case that you are absolutely desperate and definitely cannot afford a professional data recovery. Or in case you know what you are doing, e.g. if you know that it is the aging of the magnetisation layer that is causing your problem. .PP In any case do not expect too much. While complete restores have been witnessed, you should not take them for granted. A better attitude is to consider your data lost and be glad for any survivors that turn up. .PP The usual GPL disclaimer applies. Especially the NON-WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. Don't blame (or sue) me if it fails to recover or further damages your data. .PP And a final word you probably don't want to hear in this situation: For the future consider a routinely backup to avoid a "next time". .SH OPTIONS .TP .BI -b " block-size" The size of the blocks (in bytes). Set this to your harddiscs error detection/correction unit size. Usually this is 4096, which happens to be the default. .TP .BI -B " bitmap-file" The file containing the status table of all blocks. Nice (or frightening...) to view with hexdump. 01 means OK; 00 means not yet done; negative values mean the number of failed read attempts. If not given, defaults to .IB output-file .bitmap .TP .B -A Abort when encountering errors. .TP .B -S Activate skip mode: When encountering errors increase the stepsize exponentially until a readable block is found. .TP .BI -f " skip-failed" Skip blocks that have already had .I skip-failed failures. Useful to avoid scratching the same block over and over again. .TP .BI -r " retry-count" The number of times to read a block before it is declared bad for this run. (You can still retry it on the next run.) Default: 1 .TP .BI -s " start-block" The number of the block to start with. Default: 0 .TP .BI -e " end-block" The number of the block, where reading stops (not included!). Default: size of .I input-file divided by .IR block-size . .TP .B -R Reverse reading direction, i.e. from .I end-block (excluded) to .I start-block .TP .BI -G " good-range" Only try to read blocks within .I good-range blocks from an already successfully read block. .TP .BI -F " failed-range" Extends -f to also skip any block within .I failed-range blocks of a block to be skipped as specified by -f. .TP .BI -J " jump-after-blocks" Randomly jump across the disc after reading .I jump-after-blocks blocks. This might be useful to scan discs with scattered defects. In jump mode -S causes myrescue to jump to a new block upon the first failed sector or upon hitting a sector to be skipped as specified by -f, -G or -F. .TP .BR -h ", " -? Display usage information. .SH RECOMMENDED PROCEDURE .IP \(bu Make sure you have sufficient disk space to copy the whole partition (not just the used ammount of data) to plus some space for the block bitmap (1 byte per block). .IP \(bu Determine the hardware block size (CRC/ECC unit) of your harddisk. This may be found out from hdparm, some entries in /proc/ide/hd? or on the web. I have not yet checked whether this is possible with an ioctl. If you have, please let me know. .IP \(bu Start a skip mode run with one retry per block to first copy the undamaged area. .IP \(bu Start a normal run with one retry per block to copy the remaining skipped blocks. You may try to use -f 1 to skip the damaged blocks from the first run. .IP \(bu Repeat until the number of errors seems to have converged. Try waiting a couple of hours between the retries. .IP \(bu Repeat this with higher retry counts and wait for convergence. .IP \(bu Make a copy of the rescued data and run fsck on it. .IP \(bu Mount the filesystem (if copied to a file: via loopback) and check your data. If directory information has been destroyed, fsck moves unidentifiable file fragments to lost+found, so you should also check this location. .PP It may help to try reading non-defect areas in between to allow the drive to recalibrate. .PP The developers are glad to hear about your experiences. Please post them to the .B Experiences forum on the Sourceforge Project page. Thank you! .SH KNOWN BUGS The handling of the .I bitmap-file currently relies on the filesystem semantics, that when .BR lseek (2) ing beyond the end of file and then writing, the space in between is filled with zero-bytes. .PP The block bitmap overflows after 128 failed read attempts. .SH AUTHORS Kristof Koehler , Peter Schlaile .SH SEE ALSO .BR dd (1), .BR dd_rescue "(no manpage?)" .PP http://www.google.de/search?q=data+recovery .PP http://myrescue.sourceforge.net/ myrescue-0.9.4/doc/myrescue.de.10000644000175000001440000001777610664373642017327 0ustar kristofusers00000000000000.\" $Header: /cvsroot/myrescue/doc/myrescue.de.1,v 1.4 2007/08/26 21:58:58 kristofk Exp $ .TH MYRESCUE "8" "December 2004" "myrescue 0.9.2" "User Commands" .SH NAME myrescue \- Festplattenrettungstool .SH SYNOPSIS .B myrescue .RB [ -b .IR block-size ] .RB [ -B .IR bitmap-file ] .RB [ -A ] .RB [ -S ] .RB [ -r .IR retry-count ] .RB [ -f .IR skip-failed ] .RB [ -s .IR start-block ] .RB [ -e .IR end-block ] .RB [ -R ] .RB [ -G .IR good-range ] .RB [ -F .IR failed-range ] .RB [ -J .IR jump-after-blocks ] .I input-file .I output-file .SH BESCHREIBUNG myrescue ist kleines Tool, um von beschaedigten Festplatten die noch lesbaren Daten zu sichern. Es hat eine aehnliche Funktion wie dd_rescue, jedoch versucht MyRescue zuerst, die unversehrten Daten zu retten, um dann erst die zerstoerten Bereiche zu bearbeiten. .PP Das Programm versucht, das Medium Block fuer Block in eine Datei auf einer .IB anderen (!) Festplatte zu kopieren, wobei eine Tabelle ("Blockbitmap") erstellt wird, in der die erfolgreich gelesenen bzw. fehlerhaften Bloecke festgehalten werden. Diese Blockbitmap kann dann fuer weitere Leseversuche wiederverwendet werden. .PP Zudem besitzt MyRescue einen speziellen Modus, um Lesefehler zu behandeln: Normalerweise sind bei einem Festplattenschaden viele Bloecke betroffen und damit defekt bzw. zerstoert. Versuchte man nun, diese Bloecke weiterhin zu lesen, so leidet die Plattenoberflaeche, die Lesekoepfe und auch die Mechanik darunter. Die Chancen fuer die Rettung der restlichen unbeschaedigten Bereiche sinken dramatisch. .PP Im Skip-Modus versucht MyRescue, so schnell wie moeglich aus dem defekten Bereich herauszukommen. Die uebersprungenen Bloecke werden in der Blockbitmap markiert. Hat man nun die noch lesbaren Daten gesichert, kann man dann weitere Leseversuche starten. .PP Abschliessend besitzt das Programm eine Option, um mehrfache Leseversuche auf defekte Bloecke zu starten, bevor sie als Zerstoert eingetragen werden. .SH HINWEIS .B DIESES TOOL IST KEIN (!) ERSATZ FUER PROFESSIONELLE DATENRETTUNG DURCH .B DARAUF SPEZIALISIERTE FIRMEN .PP Haben Sie also die Moeglichkeit, eine solche Firma kostenguenstig (da solche Dienstleistungen sehr kostspielig sind) zu engagieren, dann sollten sie nicht einmal daran denken, MyRescue einzusetzen, da es zur weiteren Beschaedigung der Festplatte fuehren kann. MyRescue ist nur fuer ganz Verzweifelte, die sich eine professionelle Datenrettung auf keinen Fall leisten koennen und fuer diejenigen, die ganz genau wissen, was sie tun (z.B. bei Alterung der Magnetbeschichtung usw.) .PP Man sollte nicht zuviel erwarten. Den Autoren sind zwar schon komplette Restaurierungen gelungen, aber davon sollte man nicht ausgehen. Sehen Sie die Daten und Festplatte vorerst als zerstoert an. (Und freuen sich ueber alle Ueberlebenden, die doch noch auftauchen.) .PP Es gilt der uebliche GPL-Haftungsausschluss. .B INSBESONDERE SEI DARAUF HINGEWIESEN, DAS DER AUTOR KEINERLEI HAFTUNG .B FUER MISLUNGENE RETTUNGSVERSUCHE ODER ZERSTOERTE FESTPLATTEN UEBERNIMMT! .PP Auch wenn Sie das jetzt vermutlich am wenigsten hoeren wollen: Machen Sie in Zukunft regelmaessige Datensicherungen, um ein "naechstes Mal" in Sachen Datenrettung zu vermeiden. .SH OPTIONS .TP .BI -b " block-size" Die Groesse der Sektoren (fuer die Fehlererkennung) der Festplatte. Meistens sind das 4096 Bytes, was zufaellig der Defaultwert ist. .TP .BI -B " bitmap-file" Gibt den Namen der Bitmap-Datei an, die die Status aller Bloecke beinhaltet. Wenn man die Datei mittels hexdump anschaut, so steht der Wert 01 fuer korrekt gelesene Sektoren, 00 fuer noch nicht bearbeitete. Negative Werte geben die Anzahl fehlgeschlagener Leseversuche an. Gibt man keine Dateinamen an, so wird der Name .IB output-file .bitmap verwendet. .TP .B -A Wenn ein fehlerhafter Block entdeckt wird, wird der Kopiervorgang abgebrochen. .TP .B -S Aktiviert den Skip-Modus: Wenn ein fehlerhafter Block entdeckt wird, so erhoeht sich die Schrittweite exponentiell, bis wieder ein lesbarer Block gefunden wird. .TP .BI -f " skip-failed" Bloecke ueberspringen, die schon .I skip-failed mal nicht gelesen werden konnten. Damit kann vermieden werden, dass der Lesekopf immer wieder ueber den gleichen Sektor kratzt. .TP .BI -r " retry-count" Gibt die Anzahl der Leseversuche an, bis ein Block als defekt eingetragen wird. Voreinstellung ist 1 .TP .BI -s " start-block" Die Nummer des Startblocks, bei dem angefangen werden soll. Voreinstellung ist 0 .TP .BI -e " end-block" Die Nummer des Endblocks, bis zu dem gelesen werden soll (wobei dieser nicht eingeschlossen ist). Voreinstellung ist: Groesse von .I input-file dividiert durch die .IR block-size . .TP .B -R Rueckwaerts lesen, d.h. von .I end-block (nicht eingeschlossen) bis .I start-block .TP .BI -G " good-range" Es werden nur Bloecke gelesen, die hoechstens .I good-range Bloecke von einem schon erfolgreich gelesenen Block entfernt liegen. .TP .BI -F " failed-range" Erweitert die Wirkung von -f: Es werden auch Bloecke uebersprungen, die bis zu .I failed-range Bloecke von einem laut -f zu ueberspringenden Block entfernt liegen. .TP .BI -J " jump-after-blocks" Jeweils nachdem .I jump-after-blocks Bloecke gelesen wurden, wird zufaellig zu einem anderen Block gesprungen. Sinnvoll, um Platten mit verstreuten Defektbereichen zunaechst zu scannen. In diesem Modus bewirkt -S das Weiterspringen beim ersten Defekt oder beim Antreffen eines Blocks, der laut -f, -G or -F zu ueberspringen ist. .TP .BR -h ", " -? Zeigt die Online-Hilfe an. .SH EMPFOHLENE VORGEHENSWEISE .PP Bevor man sich die Prozedur der Datenrettung antuen moechte ;-), sollte man folgendes ueberdenken: .IP \(bu Der ganze Vorgang ist sehr langwierig (u. Umstaenden mehrere Stunden oder gar Tage!) und aeusserst nervenaufreibend... .IP \(bu Man braucht MINDESTENS eine zusaetzliche Festplatte oder ein genuegend grosses Medium (z.B. Streamer, ZIP-Laufwerk oder aehnliches). D.h. komplette Mediengroesse (z.B. bei einer 4 GB Partition eine ebenso grosser freier Speicher auf der Sicherungsfestplatte) plus der Blockbitmap mit je 1 Byte pro Block. .IP .PP Nun gut, hat man sich dazu entschieden, so geht man wie folgt vor: .IP \(bu Bestimmen Sie die Hardware(!)-Blockgroesse ihrer Festplatte (meistens 4096 Bytes). Dies kann mittels dem Befehl hdparm oder ueber die Webseiten des Herstellers Ihrer Festplatte geschehen. Wer weiss, wie man das direkt aus MyRescue hinbekommt, moege es mich wissen lassen. .IP \(bu Starten Sie einen Durchlauf mit skip-modus und einem Leseversuch pro Block, um zuerst die noch lesbaren Daten zu sichern. .IP \(bu Starten Sie einen weiteren Durchlauf ohne skip-modus. .IP \(bu Wiederholen Sie diesen Vorgang, bis sich die Fehlerzahl nicht mehr aendert. Man sollte aufgrund der mechanischen Erwaermung der inneren Festplattenteile zwischen den Durchlaeufen immer ein bis zwei Stunden warten. .IP \(bu Wiederholen Sie das ganze mit einer hoeheren Zahl an Leseversuchen. .IP \(bu Erstellen Sie schliesslich eine Kopie der geretteten Daten und fuehren Sie ggfs. den Befehl fsck darauf aus. .IP \(bu Mounten Sie das Dateisystem (falls in eine Datei kopiert: mittels loopback). Falls die Verzeichnisstrukturen zerstoert wurden, finden sich die noch zuzuordnenden Dateifragmente im Verzeichnis lost+found .PP Es hilft vielleicht, wenn man waehrend des Lesens von defekten Bloecken der Festplatte Zeit gibt, sich zu rekalibrieren. .PP Die Programmierer freuen sich (vor allem wenn alles glatt geht) von Ihnen und Ihren Erfahrungen hoeren, insbesondere im .B Experiences -Forum auf der Sourceforge Project Seite. Vielen Dank! .SH BEKANNTE FEHLER Das Handling der .I bitmap-file verlaesst sich darauf, dass bei .BR lseek (2) hinter das Dateiende der Bereich bis dahin mit Nullen aufgefuellt wird. .PP Die Blockbitmap laeuft nach 128 Lesefehlern ueber. .SH AUTOREN Kristof Koehler , Peter Schlaile .SH UEBERSETZUNG Holger Ohmacht Kristof Koehler .SH ANDERE TOOLS .BR dd (1), .BR dd_rescue "(no manpage?)" .PP http://www.google.de/search?q=data+recovery .PP http://myrescue.sourceforge.net/ myrescue-0.9.4/src/0000755000175000001440000000000010664374607015024 5ustar kristofusers00000000000000myrescue-0.9.4/src/Makefile0000644000175000001440000000006307576741425016467 0ustar kristofusers00000000000000CFLAGS = -Wall all: myrescue myrescue: myrescue.c myrescue-0.9.4/src/myrescue.c0000644000175000001440000003137110664373642017027 0ustar kristofusers00000000000000/* myrescue Harddisc Rescue Tool Copyright (C) 2002 Kristof Koehler (kristofk at users.sourceforge.net) Peter Schlaile (schlaile at users.sourceforge.net) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define __USE_LARGEFILE64 1 #define _LARGEFILE_SOURCE 1 #define _LARGEFILE64_SOURCE 1 #include #include #include #include #include #include #include #include #include #include #include long long filesize ( int fd ) { long long rval = lseek64(fd, 0, SEEK_END) ; if (rval < 0) { perror("filesize"); exit(-1); } return rval; } int peek_map(int bitmap_fd, int block) { char c = 0; if (lseek64(bitmap_fd, block, SEEK_SET) < 0) { perror("peek_map lseek64"); exit(-1); } if (read(bitmap_fd, &c, 1) < 0) { perror("peek_map read"); exit(-1); } return c; } void poke_map(int bitmap_fd, int block, char val) { if (lseek64(bitmap_fd, block, SEEK_SET) < 0) { perror("poke_map lseek64"); exit(-1); } if (write(bitmap_fd, &val, 1) != 1) { perror("poke_map write"); exit(-1); } } int copy_block( int src_fd, int dst_fd, long block_num, int block_size, unsigned char * buffer ) { long long filepos ; ssize_t src_count ; ssize_t dst_count ; filepos = block_num; filepos *= block_size; if (lseek64(src_fd, filepos, SEEK_SET) < 0) { perror("lseek64 src_fd"); return errno; } if (lseek64(dst_fd, filepos, SEEK_SET) < 0) { perror("lseek64 dst_fd"); return errno; } src_count = read(src_fd, buffer, block_size); if (src_count != block_size) { if (src_count == -1) { perror("src read failed"); return errno; } else { fprintf(stderr,"short read: %d of %d\n", src_count, block_size); return -1; } } dst_count = write(dst_fd, buffer, block_size); if (dst_count != block_size) { if (dst_count == -1) { perror("dst write failed"); return errno; } else { fprintf(stderr,"short write: %d of %d\n", dst_count, block_size); return -1; } } return 0; } int try_block ( int src_fd, int dst_fd, long block_num, int block_size, int retry_count, unsigned char * buffer ) { int r ; for ( r = 0 ; r < retry_count ; r++ ) { if ( copy_block ( src_fd, dst_fd, block_num, block_size, buffer ) == 0 ) return 1 ; } return 0 ; } int check_block ( int bitmap_fd, long block_num, int good_range, int failed_range, int skip_fail, long start, long end ) { int range = (good_range > failed_range) ? good_range : failed_range; int found_good = 0; long b; for ( b = block_num - range; b <= block_num + range; b++ ) { if ( (b < start) || (b >= end) ) continue; char st = peek_map(bitmap_fd,b); if ( (failed_range > 0) && (abs(block_num-b) <= failed_range) && (-st >= skip_fail) ) return 0; if ( (good_range > 0) && (abs(block_num-b) <= good_range) && (st > 0) ) found_good = 1; } return good_range > 0 ? found_good : 1; } void print_status ( long block, long start_block, long end_block, long ok_count, long bad_count ) { fprintf ( stderr, "\rblock %09ld (%09ld-%09ld) " "ok %09ld bad %09ld ", block, start_block, end_block, ok_count, bad_count ) ; } void do_copy ( int src_fd, int dst_fd, int bitmap_fd, int block_size, long start_block, long end_block, int retry_count, int abort_error, int skip, int skip_fail, int reverse, int good_range, int failed_range, unsigned char * buffer ) { long block_step = 1; long block ; long ok_count = 0 ; long bad_count = 0 ; char block_state ; int forward = !reverse; for ( block = forward ? start_block : (end_block-1) ; forward ? (block < end_block) : (block >= start_block) ; block += forward ? block_step : -block_step ) { block_state = peek_map ( bitmap_fd, block ) ; if ( (block_state <= 0) && ( (skip_fail == 0) || (-block_state < skip_fail) ) && check_block ( bitmap_fd, block, good_range, failed_range, skip_fail, start_block, end_block ) ) { print_status ( block, start_block, end_block, ok_count, bad_count ) ; if ( try_block ( src_fd, dst_fd, block, block_size, retry_count, buffer ) ) { ++ok_count ; poke_map(bitmap_fd, block, 1); block_step = 1; } else { ++bad_count; poke_map(bitmap_fd, block, block_state-1); if (abort_error) break; if (skip) block_step *= 2; } } else { if ( block % 1000 == 0 ) { print_status ( block, start_block, end_block, ok_count, bad_count ) ; } block_step = 1 ; } } print_status ( forward ? end_block : start_block, start_block, end_block, ok_count, bad_count ) ; fprintf ( stderr, "\n" ) ; } int do_jump_run ( int src_fd, int dst_fd, int bitmap_fd, int block_size, long start_block, long end_block, int retry_count, int abort_error, int skip, int skip_fail, int jump, int good_range, int failed_range, long block, int jump_count, int jump_step, long *ok_count, long *bad_count, unsigned char * buffer ) { char block_state ; for ( ; jump_count-- > 0 ; block += jump_step ) { if ( block >= end_block ) break; if ( block < start_block ) break; block_state = peek_map ( bitmap_fd, block ) ; if ( block_state > 0 ) continue; if ( ((skip_fail > 0) && (-block_state >= skip_fail)) || (!check_block ( bitmap_fd, block, good_range, failed_range, skip_fail, start_block, end_block )) ) { if (skip || abort_error) return 0; else continue; } print_status ( block, start_block, end_block, *ok_count, *bad_count ) ; if ( try_block ( src_fd, dst_fd, block, block_size, retry_count, buffer ) ) { ++(*ok_count); poke_map(bitmap_fd, block, 1); } else { ++(*bad_count); poke_map(bitmap_fd, block, block_state-1); if (skip || abort_error) return 0; } } return 1; } void do_jump ( int src_fd, int dst_fd, int bitmap_fd, int block_size, long start_block, long end_block, int retry_count, int abort_error, int skip, int skip_fail, int jump, int good_range, int failed_range, unsigned char * buffer ) { long block ; long ok_count = 0 ; long bad_count = 0 ; srandom(getpid() ^ time(NULL)); // FIXME: figure out how to decide when to quit for(;;) { block = (long long)random() ^ ((long long)random() << 16) ^ ((long long)random() << 32) ^ ((long long)random() << 48); block %= end_block - start_block; if ( block < 0 ) block += end_block - start_block; block += start_block; if ( ! do_jump_run(src_fd, dst_fd, bitmap_fd, block_size, start_block, end_block, retry_count, abort_error, skip, skip_fail, jump, good_range, failed_range, block, jump, +1, &ok_count, &bad_count, buffer) ) if ( abort_error ) break; if ( ! do_jump_run(src_fd, dst_fd, bitmap_fd, block_size, start_block, end_block, retry_count, abort_error, skip, skip_fail, jump, good_range, failed_range, block-1, jump-1, -1, &ok_count, &bad_count, buffer) ) if ( abort_error ) break; } fprintf(stderr,"\n"); } const char * usage = "myrescue [] \n" "options:\n" "-b block size in bytes, default: 4096\n" "-B bitmap-file, default: .bitmap\n" "-A abort on error\n" "-S skip errors (exponential-step)\n" "-f skip blocks with or more failures\n" "-r try up to reads per block, default: 1\n" "-s start block number, default: 0\n" "-e end block number (excl.), default: size of \n" "-G only read blocks around good ones\n" "-F skip blocks around failed ones\n" "-J randomly jump after reading a few sectors\n" "-R reverse copy direction\n" "-h, -? usage information\n" ; int main(int argc, char** argv) { char *src_name ; char *dst_name ; char *bitmap_name = NULL ; char bitmap_suffix[] = ".bitmap" ; int block_size = 4096 ; int abort_error = 0 ; int skip = 0 ; int skip_fail = 0 ; int retry_count = 1 ; long start_block = 0 ; long end_block = -1 ; int reverse = 0 ; int jump = 0 ; int good_range = 0 ; int failed_range = 0 ; long long block_count ; int dst_fd ; int src_fd ; int bitmap_fd ; unsigned char* buffer ; int optc ; /* options */ while ( (optc = getopt ( argc, argv, "b:B:ASf:r:s:e:J:G:F:Rh?" ) ) != -1 ) { switch ( optc ) { case 'b' : block_size = atol(optarg); if (block_size <= 0) { fprintf(stderr, "invalid block-size: %s\n", optarg); exit(-1); } break ; case 'B' : bitmap_name = optarg; break ; case 'A' : abort_error = 1 ; break ; case 'S' : skip = 1 ; break ; case 'f' : skip_fail = atol(optarg); if (skip_fail <= 0) { fprintf(stderr, "invalid skip-failed level: %s\n", optarg); exit(-1); } break ; case 'r' : retry_count = atol(optarg); if (retry_count <= 0) { fprintf(stderr, "invalid retry-count: %s\n", optarg); exit(-1); } break ; case 's' : start_block = atol(optarg); if (start_block <= 0) { fprintf(stderr, "invalid start_block: %s\n", optarg); exit(-1); } break ; case 'e' : end_block = atol(optarg); if (end_block <= 0) { fprintf(stderr, "invalid end_block: %s\n", optarg); exit(-1); } break ; case 'J' : jump = atol(optarg); if (jump <= 0) { fprintf(stderr, "invalid jump value: %s\n", optarg); exit(-1); } break ; case 'G' : good_range = atol(optarg); if (good_range <= 0) { fprintf(stderr, "invalid good range value: %s\n", optarg); exit(-1); } break ; case 'F' : failed_range = atol(optarg); if (failed_range <= 0) { fprintf(stderr, "invalid failed range value: %s\n", optarg); exit(-1); } break ; case 'R' : reverse = 1 ; break ; default : fprintf ( stderr, "%s", usage ) ; exit(-1) ; } } if (optind != argc - 2) { fprintf ( stderr, "%s", usage ) ; exit(-1) ; } /* buffer */ buffer = malloc ( block_size ) ; if ( buffer == NULL ) { fprintf ( stderr, "malloc (%d) failed\n", block_size ) ; exit(-1) ; } /* filenames */ src_name = argv[optind] ; dst_name = argv[optind+1] ; if ( bitmap_name == NULL ) { bitmap_name = malloc ( strlen(dst_name) + strlen(bitmap_suffix) + 1 ) ; if ( bitmap_name == NULL ) { fprintf ( stderr, "malloc failed\n" ) ; exit(-1) ; } strcpy ( bitmap_name, dst_name ) ; strcat ( bitmap_name, bitmap_suffix ) ; } /* open files */ src_fd = open64(src_name, O_RDONLY); if ( src_fd < 0 ) { perror ( "source open failed" ) ; exit(-1) ; } dst_fd = open64(dst_name, O_RDWR | O_CREAT, 0600); if ( dst_fd < 0 ) { perror ( "destination open failed" ) ; exit(-1) ; } bitmap_fd = open64(bitmap_name, O_RDWR | O_CREAT, 0600); if ( bitmap_fd < 0 ) { perror ( "bitmap open failed" ) ; exit(-1) ; } /* maximum block */ block_count = filesize(src_fd) ; block_count /= block_size ; if ( end_block == -1 ) { end_block = block_count ; } #ifdef CHECK_END_BLOCK if ( end_block > block_count ) { fprintf ( stderr, "end_block(%ld) > block_count(%Ld)\n" "end_block clipped\n", end_block, block_count ) ; end_block = block_count ; } #endif if ( start_block >= end_block ) { fprintf ( stderr, "start_block(%ld) >= end_block(%ld)\n", start_block, end_block ) ; exit(-1) ; } /* start the real job */ if ( jump == 0 ) do_copy ( src_fd, dst_fd, bitmap_fd, block_size, start_block, end_block, retry_count, abort_error, skip, skip_fail, reverse, good_range, failed_range, buffer ) ; else do_jump ( src_fd, dst_fd, bitmap_fd, block_size, start_block, end_block, retry_count, abort_error, skip, skip_fail, jump, good_range, failed_range, buffer ); return 0 ; }