PERL BEGINNERS 38 RE DATA RECOVERY EXT3 WAS RE RECOVER ZIP FILE VIA ARCHIVE ZI P
Subject: RE: data recovery ext3 (was RE: Recover zip file via Archive::Zi p)
Date: Fri, 8 Aug 2003 09:58:50 -0400

From: william_west@no-spam (William M West)

>From: Tassilo von Parseval [mailto:tassilo.parseval@no-spam
>Subject: Re: data recovery ext3 (was RE: Recover zip file via Archive::Zip)
>
>On Thu, Aug 07, 2003 at 03:09:06PM -0400 West, William M wrote:
>>
>> i am not sure what all the components do anymore- i did not document it >well >> :P >
>Let me help. :-)

why thank you :)

>> now that i've looked at it, it's really for getting to files that are >> unlinked etc..... so i am not sure it will do you any good.
>
>Partly it might. The only problem with your script is that it cannot >deal with data that is spanning more than 12 inodes (those were usually >not in one block but fragmented over the harddisk). A line like this >shows such a trickier example:
>
> 99526 0 100644 676132 1/1027 Sat Feb 2 09:11:58 2002

well.. this is interesting- i am not sure how to interpret this line properly. also, i assume that even split inodes will all get shoved through the script... so, perhaps there is a way to concatonate/rename the split inodes? or is there no way to see which belongs to which group?

>
>I don't by hard know what to do with it, but it is laid out in the ext2
>undeletion how-to.

well- this gives me a place to start looking. :)

>
>> to bring this more on topic, i would like to see what ways something like >> this can be improved- it served useful to me in the past, but i'm sure it >> can be made more useful:::
>>
>>
>> #!/usr/bin/perl >>
>> # added proper things when retyping it:
>> use warnings;
>> use diagnostics;
>> use strict;
>> #-------------------
>>
>> my $cfile = "/tmp/commands.file";
>> my $filesystem ="/dev/hda6";
>> my @no-spam = ("/tmp/recover","","/recover","",".ebu"); #making a path to >put >> my $date="Oct"; #just files from October #stuff later >>
>> open (OUT,">$cfile");
>> print OUT "open $filesystem\n";# i wonder what this is for?
>
>Debug message?

no-> i wasn't all that sophisticated.. *shrug*
>
>> foreach (`/sbin/debugfs -R lsdel /dev/hda6`){#why did i hard code >/dev/hda6?
>>
>> #debugfs let's me list a bunch of inodes and i stick the list in a file >>
>> m/(\d+)/;
>> $path[3]=$1; #had to split this regex to dead with some edge >case >> $1=~m/(\d)/; # but i can't recall what....
>>
>> $path[1]=$1;
>> my $quatch = join("",@no-spam >> my $place= "path[0]$path[1]";
>> print OUT("dump <$path[3]> $quatch\n") if ((m/$date/));
>
>Essentially, from a line like >
> 2210070 1000 100600 22843 2/ 6 Wed Jul 23 09:26:10 2003
>
>you extract the inode (2210070) and from that turn >
> my @no-spam = ("/tmp/recover","","/recover","",".ebu");
>
>into >
> @no-spam = ("/tmp/removed", 2, "/recover", 2210070, ".ebu");
>
>So the deleted inode gets dumped into >
> /tmp/removed/2/recover/2210070.ebu ^^^^^^^--- typo! *laugh*
>
>This could have been done more easily:
>
> @no-spam = /((\d)\d+)/;

fantastic! i have never been terribly good with regexes and am trying to avoid learning them again until perl6 *laugh* i must to too darn lazy!!

>
>> `mkdir $place`;
>> }

>>
>>
>> -----------------
>>
>> then i chmod 755 command.file? or is it a file used by another tool???
>
>command.file is the list of dump directives. It's supposedly a shell >script that you can run later. So the above Perl script just generates >another script. I am just not sure about >
>> print OUT "open $filesystem\n";
>
> open /dev/hda6
>
>is not a meaningful command in shell scripts AFAIK.
>

i agree- but something is nagging at the back of my head, telling me that it was useful.... perhaps it is readable by another command... instead of using mount... *sigh* i don't know :P
>Tassilo
i'll try to rewrite it... see if i can get it to work again :)