_("Your account"))); dual_begin(array()); print("
" . _("You have not authenticated yourself to the system yet with your") . " " . _("username") . " " . _("and") . " " . _("password") . ". " . _("You will not be able to use this section of the website without authenticating yourself first. So, please continue and login using the form on the right hand side.") . "
\n"); dual_middle(array()); show_account_details(array()); dual_end(array()); generic_footer(array()); exit; } /* $mdp = popen("/usr/bin/sudo /sbin/mdadm --examine --brief --scan --config=partitions", "r"); $i = 0; while (!feof($mdp)) { $mdstr = trim(fgets($mdp, 4096)); $mdresult[$i++] = $mdstr; } pclose($mdp); $i = 0; $md_devices = array(); while ($i < count($mdresult)) { if (substr($mdresult[$i], 0, 6) == "ARRAY ") { $mdarray = explode(" ", $mdresult[$i]); $mdlevel = -1; switch($mdarray[2]) { case "level=raid0": $mdlevel = 0; break; case "level=raid1": $mdlevel = 1; break; case "level=raid5": $mdlevel = 5; break; default: $mdlevel = -1; break; } array_push($md_devices, array("device" => $mdarray[1], "level" => $mdlevel)); } $i++; } */ $disksp = popen("/usr/bin/sudo /opt/openfiler/sbin/list-disks.pl", "r"); $i = 0; while (!feof($disksp)) { $dstr = trim(fgets($disksp, 4096)); // $dresult[$i++] = substr($dstr, 0, strlen($dstr) - 1); $dresult[$i++] = $dstr; } pclose($disksp); $of_disks = array(); if ($dresult[0] == "OPENFILER") { $i = 1; while ($i < count($dresult)) { if ($dresult[$i] == "DISK") { $p = $i; $i = $i + 8; $parts = array(); while (($dresult[$i] == "PARTITION") && ($i < count($dresult))) { array_push($parts, array("device" => $dresult[$i + 1], "type" => $dresult[$i + 2], "number" => $dresult[$i + 3], "start" => $dresult[$i + 4], "end" => $dresult[$i + 5], "blocks" => $dresult[$i + 6], "extended" => $dresult[$i + 7])); $i = $i + 8; } array_push($of_disks, array("device" => $dresult[$p + 1], "type" => $dresult[$p + 2], "description" => $dresult[$p + 3], "blocksize" => ($dresult[$p + 4] * 2), "cylinders" => $dresult[$p + 5], "heads" => $dresult[$p + 6], "sectors" => $dresult[$p + 7], "partitions" => $parts)); } else break; } } $found = false; $disk_index = -1; for ($i = 0; $i < count($of_disks); $i++) { if ($of_disks[$i]["device"] == $dev) { $found = true; $disk_index = $i; break; } } if (!$found) { header("Location: ./volumes_physical.html"); exit; } $extended_partitions_exist = false; $in_use = array(); for ($j = 0; $j < count($of_disks[$disk_index]["partitions"]); $j++) { if (intval($of_disks[$disk_index]["partitions"][$j]["number"]) > 4) $extended_partitions_exist = true; $pvp = popen("/usr/bin/sudo /sbin/pvdisplay " . $of_disks[$disk_index]["partitions"][$j]["device"], "r"); $pvstr = trim(fgets($pvp, 4096)); pclose($pvp); $in_use[$j] = false; if (strcmp($pvstr, "--- Physical volume ---") == 0) $in_use[$j] = true; } if ($action == "deletepartition") { for ($j = 0; $j < count($of_disks[$disk_index]["partitions"]); $j++) { if ($of_disks[$disk_index]["partitions"][$j]["device"] == $device) { $ptype = $of_disks[$disk_index]["partitions"][$j]["type"] . ""; if ((($ptype != "8e") && ($ptype != "05") && ($ptype != "0f") && ($ptype != "5") && ($ptype != "f"))) continue; else if ((($ptype == "05") || ($ptype == "0f") || ($ptype == "5") || ($ptype == "f")) && ($extended_partitions_exist)) continue; else if ($in_use[$j]) continue; exec("/usr/bin/sudo /sbin/parted -s " . escapeshellarg($dev) . " rm " . escapeshellarg($of_disks[$disk_index]["partitions"][$j]["number"])); exec("/usr/bin/sudo /sbin/partprobe"); } } header("Location: ./volumes_editpartitions.html?dev=" . urlencode($dev)); exit; } else if ($action == "createpartition") { $start_mb = ($start * ($of_disks[$disk_index]["blocksize"] / 2) * $of_disks[$disk_index]["sectors"] * $of_disks[$disk_index]["heads"]) / (1024 * 1024.0); $end_mb = ($end * ($of_disks[$disk_index]["blocksize"] / 2) * $of_disks[$disk_index]["sectors"] * $of_disks[$disk_index]["heads"]) / (1024 * 1024.0); if (($mode == "primary") && ($type == "extended")) { exec("/usr/bin/sudo /sbin/parted -s " . escapeshellarg($dev) . " mkpart extended " . escapeshellarg($start_mb) . " " . escapeshellarg($end_mb)); exec("/usr/bin/sudo /sbin/partprobe"); } else if ($type != "extended") { exec("/usr/bin/sudo /sbin/parted -s " . escapeshellarg($dev) . " mkpart " . escapeshellarg($mode) . " " . escapeshellarg($start_mb) . " " . escapeshellarg($end_mb)); exec("/usr/bin/sudo /sbin/partprobe"); $disksp = popen("/usr/bin/sudo /opt/openfiler/sbin/list-disks.pl", "r"); $i = 0; while (!feof($disksp)) { $dstr = trim(fgets($disksp, 4096)); // $dresult[$i++] = substr($dstr, 0, strlen($dstr) - 1); $dresult[$i++] = $dstr; } pclose($disksp); $of_disks2 = array(); if ($dresult[0] == "OPENFILER") { $i = 1; while ($i < count($dresult)) { if ($dresult[$i] == "DISK") { $p = $i; $i = $i + 8; $parts = array(); while (($dresult[$i] == "PARTITION") && ($i < count($dresult))) { array_push($parts, array("device" => $dresult[$i + 1], "type" => $dresult[$i + 2], "number" => $dresult[$i + 3], "start" => $dresult[$i + 4], "end" => $dresult[$i + 5], "blocks" => $dresult[$i + 6], "extended" => $dresult[$i + 7])); $i = $i + 8; } array_push($of_disks2, array("device" => $dresult[$p + 1], "type" => $dresult[$p + 2], "description" => $dresult[$p + 3], "blocksize" => ($dresult[$p + 4] * 2), "cylinders" => $dresult[$p + 5], "heads" => $dresult[$p + 6], "sectors" => $dresult[$p + 7], "partitions" => $parts)); } else break; } } $found = false; $disk_index2 = -1; for ($i = 0; $i < count($of_disks2); $i++) { if ($of_disks2[$i]["device"] == $dev) { $found = true; $disk_index2 = $i; break; } } if (!$found) { header("Location: ./volumes_physical.html"); exit; } for ($i = 0; $i < count($of_disks2[$disk_index2]["partitions"]); $i++) { /* Got to check the extents and not the partition numbers */ $found = false; for ($j = 0; $j < count($of_disks[$disk_index]["partitions"]); $j++) if (($of_disks2[$disk_index2]["partitions"][$i]["start"] == $of_disks[$disk_index]["partitions"][$j]["start"]) && ($of_disks2[$disk_index2]["partitions"][$i]["end"] == $of_disks[$disk_index]["partitions"][$j]["end"])) { $found = true; break; } if (!$found) { exec("/usr/bin/sudo /sbin/parted -s " . escapeshellarg($dev) . " set " . escapeshellarg($of_disks2[$disk_index2]["partitions"][$i]["number"]) . " lvm on"); exec("/usr/bin/sudo /sbin/partprobe"); exec("/usr/bin/sudo /sbin/pvcreate " . escapeshellarg($of_disks2[$disk_index2]["partitions"][$i]["device"])); exec("/usr/bin/sudo /sbin/partprobe"); break; } } } header("Location: ./volumes_editpartitions.html?dev=" . urlencode($dev)); exit; } generic_header(array("title" => _("Administration Section"))); single_begin(array()); print("Welcome Administrator. The following are various system information and preferences, arranged into tabs. Please click on a tab to open up that category.
Edit partitions in " . $of_disks[$disk_index]["device"] . " (" . ($of_disks[$disk_index]["cylinders"]) . " cylinders)\n"); print("\n"); print("
Device | \n"); print("\tType | \n"); print("\tNumber | \n"); print("\tStart cyl | \n"); print("\tEnd cyl | \n"); print("\tBlocks | \n"); print("\tSize | \n"); print("\tType | \n"); print("\tDelete | \n"); print("
" . $of_disks[$disk_index]["partitions"][$j]["device"] . " | \n"); print("\t" . $ptype_str . " | \n"); print("\t" . $of_disks[$disk_index]["partitions"][$j]["number"] . " | \n"); print("\t" . $of_disks[$disk_index]["partitions"][$j]["start"] . " | \n"); print("\t" . $of_disks[$disk_index]["partitions"][$j]["end"] . " | \n"); print("\t" . $of_disks[$disk_index]["partitions"][$j]["blocks"] . " | \n"); print("\t" . $part_size_string . " | \n"); print("\t" . (($of_disks[$disk_index]["partitions"][$j]["number"] > 4) ? "Logical" : "Primary") . " | \n"); print("\t"); if ((($ptype != "8e") && ($ptype != "05") && ($ptype != "5") && ($ptype != "0f") && ($ptype != "f"))) print("Not my cup of tea"); else if ((($ptype == "05") || ($ptype == "5") || ($ptype == "0f") || ($ptype == "f")) && ($extended_partitions_exist)) print("Extended partitions exist"); else if ($in_use[$j]) print("In use"); else print("Delete\n"); print(" | \n"); print("
\n"); print("
Back to the list of physical storage devices
\n"); print("\n"); print("
You can use ranges within the following extents:
\n"); array_multisort($primary_start_array, $primary_end_array); array_multisort($extended_start_array, $extended_end_array); $primary_free_start_array = array(); $primary_free_end_array = array(); $extended_free_start_array = array(); $extended_free_end_array = array(); print("Mode | \n"); print("\tStarting cylinder | \n"); print("\tEnding cylinder | \n"); print("\tSpace | \n"); print("
Primary | \n"); print("\t" . $t . " | \n"); print("\t" . ($primary_start_array[$i] - 1) . " | \n"); print("\t" . $extent_size_string . " | \n"); print("
Primary | \n"); print("\t" . $t . " | \n"); print("\t" . $of_disks[$disk_index]["cylinders"] . " | \n"); print("\t" . $extent_size_string . " | \n"); print("
Logical | \n"); print("\t" . $t . " | \n"); print("\t" . ($extended_start_array[$i] - 1) . " | \n"); print("\t" . $extent_size_string . " | \n"); print("
Logical | \n"); print("\t" . $t . " | \n"); print("\t" . $of_disks[$disk_index]["partitions"][$extended_partition_index]["end"] . " | \n"); print("\t" . $extent_size_string . " | \n"); print("
\n"); nested_tab_end(); single_end(array()); generic_footer(array()); ?>