Handle hostnames with upper-case letters
[webmin.git] / format / edit_disk.cgi
1 #!/usr/local/bin/perl
2 # edit_disk.cgi
3 # Display information about a disk, with links to low-level format,
4 # repair and other dangerous options
5
6 require './format-lib.pl';
7 $access{'view'} && &error($text{'ecannot'});
8 &ui_print_header(undef, "Edit Disk", "");
9 print "<table width=100%><tr> <td valign=top>\n";
10 $d = $ARGV[0];
11
12 @dlist = &list_disks();
13 @dinfo = split(/\s+/, $dlist[$d]);
14 print "<table border width=100%>\n";
15 print "<tr $tb> <td><b>Disk Details</b></td> </tr>\n";
16 print "<tr $cb> <td><table>\n";
17 print "<tr> <td><b>Disk Type:</b></td> <td>$dinfo[1]</td> </tr>\n";
18 print "<tr> <td><b>Device:</b></td> <td><tt>/dev/dsk/$dinfo[0]</tt></td> </tr>\n";
19
20 print "<tr> <td valign=top><b>SCSI:</b></td>\n";
21 $dinfo[0] =~ /c(\d+)t(\d+)d(\d+)/;
22 print "<td><table>\n";
23 print "<tr> <td>Controller</td> <td>$1</td> </tr>\n";
24 print "<tr> <td>Target</td> <td>$2</td> </tr>\n";
25 print "<tr> <td>Unit</td> <td>$3</td> </tr></table></td> </tr>\n";
26
27 print "<tr> <td valign=top><b>Vendor:</b></td>\n";
28 @inq = &disk_info($d);
29 print "<td><table>\n";
30 print "<tr> <td>Name</td> <td>$inq[0]</td> </tr>\n";
31 print "<tr> <td>Product</td> <td>$inq[1]</td> </tr>\n";
32 print "<tr> <td>Revision</td> <td>$inq[2]</td> </tr></table></td> </tr>\n";
33 print "</table></td></tr></table>\n";
34
35 print "</td> <td valign=top>\n";
36
37 print "<table border width=100%>\n";
38 print "<tr $tb> <td colspan=2><b>Disk Tasks</b></td> </tr>\n";
39 @plist = &list_partitions($d);
40 for($i=0; $i<@plist; $i++) {
41         @stat = &device_status("/dev/dsk/$dinfo[0]s$i");
42         if (@stat) { $inuse = 1; }
43         if ($stat[2]) { $mounted = 1; }
44         }
45
46 print "<tr $cb> <form action=format_form.cgi>\n";
47 print "<td valign=top><b>Format Disk</b><br>\n";
48 if (!$inuse) {
49         print "<input type=hidden name=disk value=$d>\n";
50         print "<input type=submit value=\"Format\"></td>\n";
51         print "<td>Does a low level format of the disk, permanently erasing\n";
52         print "all data. This is only necessary if the disk has not been\n";
53         print "formatted by the vendor.</td> </tr>\n";
54         }
55 else {
56         print "</td> <td>You cannot format this disk because it contains\n";
57         print "filesystems that are in the system mount list.</td> </tr>\n";
58         }
59 print "</form> </tr>\n";
60
61 print "<tr $cb> <form action=copy_part_form.cgi>\n";
62 print "<td valign=top><b>Copy Partitions</b><br>\n";
63 print "<input type=hidden name=disk value=$d>\n";
64 print "<input type=submit value=\"Copy\"></td>\n";
65 print "<td>Copy the partition map from this disk to other disks. This\n";
66 print "is useful if you have a large number of disks that need the same\n";
67 print "partition layout, such as for a MetaDisk array.</td> </tr>\n";
68 print "</form> </tr>\n";
69
70 print "</table>\n";
71
72 print "</td> </tr></table><p>\n";
73 &ui_print_footer("", "disk list");
74