#!/usr/local/bin/perl # copy_part_form.cgi # Display a form for copying the partitions map of this disk to otthers require './format-lib.pl'; &ReadParse(); $access{'view'} && &error($text{'ecannot'}); &ui_print_header(undef, "Copy Partition Map", ""); $extwidth = 400; print "This form allows you to copy the partition map from this disk\n"; print "to others of the same size. This is useful for setting up disks\n"; print "for use as parts of a RAID or mirrored MetaDisk.

\n"; print "\n"; print "\n"; print "\n"; @dlist = &list_disks(); @dinfo = split(/\s+/, $dlist[$in{disk}]); $cyl = $dinfo[2]; @plist = &list_partitions($in{disk}); for($i=0; $i<@plist; $i++) { @p = split(/\s+/, $plist[$i]); print "\n"; if ($p[3]) { printf "\n", $extwidth*($cyl-$p[3])/$cyl; print "\n"; } else { print "\n"; } print "\n"; } print "
Partition TagExtent Start End
$i $p[0]", $extwidth*$p[2]/$cyl; printf "", $extwidth*($p[3]-$p[2])/$cyl; printf "$p[2] $p[3]

\n"; # find all disks that are not in use print "Select the disks to copy this partition map to..
\n"; print "

\n"; print "\n"; print "\n"; print " \n"; print " \n"; for($i=0; $i<@dlist; $i++) { print "\n"; print "\n"; $d[0] =~ /c(\d+)t(\d+)d(\d+)/; print "\n"; if ($err) { print "\n"; } else { print "\n"; } if (!$err) { $foundone = 1; } } print "
Disk Type CylindersController TargetUnit Device
"; @d = split(/\s+/, $dlist[$i]); undef($err); if ($d[2] ne $cyl) { $err = "Different disk size"; } elsif ($i == $in{disk}) { $err = "Source disk"; } else { @plist = split(/\s+/, &list_partitions($i)); for($j=0; $j<@plist; $j++) { $dev = "/dev/dsk/$d[0]s$j"; if (&device_status($dev)) { $err = "Currently in use"; } } } if (!$err) { print "\n"; } else { print "
"; } print "
$d[1] $d[2]$1 $2 $3 $d[0]$err
Possible target

\n"; if ($foundone) { print "\n"; } else { print "No disks are possible targets for copying.\n"; } print "

\n"; &ui_print_footer("", "disk list");