--nFreZHaLTZJo0R7j
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
As a followup, I have actually written said script (in perl), and would wel=
come
any improvement comments. File size of the test file shouldn't matter, since
without wear leveling, the same cells should get written over and over agai=
n.
Only thing I need to do now is run it for a long time... Unfortunately, I n=
eed
linux for that since we need to mount the drive sync. And I have no live CD=
in
the house... Ts. What have I come to?
Anyway, here's the script:=20
use strict;
use warnings;=20
use Digest::MD5;
use Getopt::Std;
use File::Basename;
use File::Spec;
use File::Copy;
my %opts;
getopts("d:i:",\%opts);
if (! $opts{d} || ! $opts{i}) {
die <<"EOF"
-d: Mountpoint of drive to be tested. Should be mounted with "sync" mount o=
ption.
-i: Input file. Will be copied to mountpoint to test integrity.
Leave running for a long time to "test" your USB stick.
EOF
}
my $counter =3D 0;
my $originaldigest;
my $outfilename =3D File::Spec->catfile($opts{d},(fileparse($opts{i}))[0]);
my $digester =3D Digest::MD5->new();
open my $handle,"<$opts{i}";
binmode($handle);
$digester->addfile($handle);
close($handle);
$originaldigest =3D $digester->digest();
while (1) {
print "Running test $counter.\n";
copy($opts{i},$outfilename);
open my $outhandle,"<$outfilename";
binmode($outhandle);
$digester->addfile($outhandle);
if ($digester->digest() ne $originaldigest) {
die "Failed write at read $counter.\n";
}
close($outhandle);
unlink($outfilename);
$counter++;
}
--=20
thenybble.de/blog/ -- four bits at a time
--nFreZHaLTZJo0R7j
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)
iD8DBQFH3WDfMmLQdC6jvocRAoC9AJ9C7KkRy7CqOr6CAtiPrMLQrH7M9ACeIxhb
iSLI7HWAXu4yEMfhdWZXXIU=
=BlIN
-----END PGP SIGNATURE-----
--nFreZHaLTZJo0R7j--
--
gentoo-user@lists.gentoo.org mailing list