From: Emmanuel Florac <eflorac@intellique.com>
To: Marcel z maleho mesta <newsx@btinternet.com>
Cc: xfs@oss.sgi.com
Subject: Re: Structure needs cleaning - Seagate Expansion External HDD 2TB USB
Date: Sun, 16 May 2010 21:33:07 +0200 [thread overview]
Message-ID: <20100516213307.4252621c@galadriel.home> (raw)
In-Reply-To: <4BEF12A5.2030505@btinternet.com>
Le Sat, 15 May 2010 22:31:17 +0100 vous écriviez:
> but the most important one "DVBgrab" with about
> 400Gb of data :( (each file is between 1 and 2 Gb)
Don't write anything to your drive. Here is a perl script I wrote to
find back lost DV files from a huge corrupted array.
Mount some other place to save the found files to /mnt/destination,
then run the script passing the device to search as parameter.
#!/usr/bin/perl
use strict;
use warnings;
$|=1 ;
my ( $file ) = @ARGV;
my $blocksize = 4096 ;
my $lookupstring = pack "H*", "1F0700" ;
my $regexp = qr/^(.*?)($lookupstring.*)$/s ;
open ( my $raid, "< $file" ) or die "can't open $file \n" ;
{
my $block ;
my $offset = 0 ;
my $nextblock = 0;
my $testfile;
# frame size is 1440000 bytes
my $framebuffer1 = '' ;
my $outnumber = 0;
seek $raid, $offset, 0 or die ;
while ( my $readbytes = read $raid, $block, $blocksize ) {
$offset += $readbytes ;
print "* offset : $offset\n" unless ( $offset %
1073741824 ) ;
if ( length $framebuffer1 == 0 ) {
if ( $block =~ m/$regexp/ ) {
print "found, file $outnumber
offset $offset\n"; $framebuffer1 = $2 ;
}
} elsif ( length $framebuffer1 < 144000 - $blocksize ) {
$framebuffer1 .= $block ;
print "file head inside : offset $offset\n" if
( $block =~ m/$regexp/ ) ; } elsif ( length $framebuffer1 == 144000 -
$blocksize ) { $framebuffer1 .= $block ;
} else {
$framebuffer1 .= substr( $block, 0, ( 144000 -
length $framebuffer1 ) ) ;
if ( not $testfile ) {
print "OPEN\n";
open $testfile,
">/mnt/destination/out". sprintf ("%09d", $outnumber) . ".dv" or die
"can't write file $outnumber "; }
print $testfile $framebuffer1 ;
if ( $block =~ m/$regexp/ ) {
print "found, file $outnumber
offset $offset\n"; $framebuffer1 = $2 ;
} else {
print "CLOSE\n" ;
close $testfile ;
undef $testfile ;
$framebuffer1 = '' ;
$outnumber++;
}
}
}
}
--
------------------------------------------------------------------------
Emmanuel Florac | Direction technique
| Intellique
| <eflorac@intellique.com>
| +33 1 78 94 84 02
------------------------------------------------------------------------
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2010-05-16 19:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-15 21:31 Structure needs cleaning - Seagate Expansion External HDD 2TB USB Marcel z maleho mesta
2010-05-16 17:59 ` Eric Sandeen
2010-05-16 19:33 ` Emmanuel Florac [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-05-15 22:07 Marcel z maleho mesta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100516213307.4252621c@galadriel.home \
--to=eflorac@intellique.com \
--cc=newsx@btinternet.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox