我有一个非常奇怪的问题,备份一直运作到最近。这就是我的基于perl的备份脚本所做的事情:
Create Volume Shadow Copy snapshot of filesystem
Get file list from VSC for later verification
Do mirror backup with ROBOCOPY
Take statistical sample of file list, comparing each file on the backup against the VSC
我遇到的问题是它发现VSC上显然不再存在某些文件。他们刚刚做了这个脚本,这个脚本是唯一一个可以访问VSC并且不会从中删除单个文件的脚本。
我检查的第一个示例文件是自2010年以来未被触及的文件,在备份驱动器上存在,并且是普通的用户数据文件,名称中没有特殊字符,也没有特别长的文件路径(64字节)。然而,我得到了以下各项的组合:
现在,如果它根据我用/ MIR运行的ROBOCOPY不存在,那么它会将它从备份驱动器中删除,但它没有:我仍然可以在备份驱动器上看到它。所以我知道,从镜像备份步骤开始,它就存在于VSC上。在这段代码中,文件是如何从VSC中消失的?
my @files = ();
open(INP, '<' . $filelist) or die "Could not open $filelist: $!";
while (<INP>) {
chomp($_);
push @files, $_;
}
close(INP);
my $sample_size = int(384.16/(1+(384.16-1)/$#files));
use Algorithm::Numerical::Sample qw(sample);
my @sample = sample(set => [1..$#files], sample_size => $sample_size);
my $detail_output_filename = 'temp\\bad_file_details.log';
my @bad_files = ();
for (@sample)
{
my $live_file = $files[$_];
$live_file =~ /^C:\\scheduled\\res\\C\\(.*)$/;
my $backup_equiv = "E:\\$1";
my $result = $psm->sys(undef, 'res\\cmp.exe "' . $live_file . '" "' . $backup_equiv . '" >> "' . $detail_output_filename . '"');
if ($result)
{
my $age_difference = (((stat($live_file))[9] // 0) - ((stat($backup_equiv))[9] // 0));
my $size_difference = (((-s $live_file) // 0) - ((-s $backup_equiv) // 0));
my $bad_msg = "$age_difference s older, " . (($size_difference > 0) ? "$size_difference b smaller" : -$size_difference . " b larger" ) . ": $backup_equiv";
$bad_msg = "$live_file didn't exist, backed up size was " . ((-s $backup_equiv) // 'undef') unless -e $live_file;
$bad_msg = "$backup_equiv didn't exist, live size was " . ((-s $live_file) // 'undef') unless -e $backup_equiv;
push @bad_files, "$age_difference s older, " . (($size_difference > 0) ? "$size_difference b smaller" : -$size_difference . " b larger" ) . ": $backup_equiv";
die "Real trouble with $backup_equiv" if $result == 2;
}
}
我没有看到任何删除文件的内容。我的sys()
也没有。 VS副本可能会发生什么?