#!/bin/perl # Script to predict backup success # Written 2/24/98 by Robert G. Ferrell # Revised: 8/31/99 RGF $total = 0; $max_space = 12000000000; #Set this to your tape's capacity in bytes $count = 1; print "*****************************************\n"; print "Analyzing backup space requirements...\n"; @raw_devs = qx(df -k | grep '/dev/dsk' | grep -v 'vol'); foreach $dev (@raw_devs) { ($dev_name,$rest) = split(/\s+/, $dev); push(@devs, $dev_name); } foreach $part (@devs) { if ($count == 1) { $r_amt = qx(ufsdump 0S $part); $count++; } else { $r_amt = qx(ufsdump 0S $part); } $f_amt = $r_amt/1000000; $total += $r_amt; printf("$part will require %ldMB\n", $f_amt); } $final = $total/1000000; printf("The total space required is %ldMB\n", $final); if ($total > $max_space) { print "Backup = FAIL: This will exceed the uncompressed capacity of one tape.\n"; } else { print "Backup = PASS: One 12 GB tape should hold this.\n\n"; print "*****************************************\n"; }