4 <form action = "volumes_create_raid.cgi" method = "post">
7 <div class="messageblock messageblock-info">
8 <div class="messageblock-internal">
9 <p> Select a Raid type in the list below.</p>
11 <select name="raid_method">
12 <option value="no">无阵列</option>
13 <option value="raid0">Raid-0</option>
14 <option value="raid1">Raid-1</option>
15 <option value="raid5">Raid-5</option>
16 <option value="raid6">Raid-6</option>
17 <option value="raid10">Raid-10</option>
22 sudo fdisk
-l |
grep 'Disk /dev' |
sed 's:.*\(/dev.*GB\).*:\1:' >/tmp
/disks.tmp
27 <div class="messageblock messageblock-info">
28 <div class="messageblock-internal"><p>
29 创建Raid-0, Raid-1 至少要两块硬盘. Raid-5 需要3块硬盘. Raid-6, Raid-10至少需要4块硬盘.<br>
34 <table cellspacing="2" cellpadding="8" border="0" width="95%">
35 <tr align="center"><td bgcolor="#ebebeb"><strong>硬盘</strong></td><td bgcolor="#ebebeb"><strong>容量</strong></td><td bgcolor="#ebebeb"><strong>型号</strong></td><td bgcolor="#ebebeb"><strong>状态</strong></td></tr>
41 dev
=$
(echo $line | cut
-f1 -d:)
42 size
=$
(echo $line | cut
-f2 -d:)
43 model
=$
(sudo hdparm
-I $dev|
grep 'Model Number' | cut
-f2 -d: |
tr -s ' ')
45 if df
-h |
grep -q $dev; then
46 echo "<tr bgcolor="#c6d5a8" align="center"><td><input type=\"checkbox\" name=\"devs_$count\" value=\"$dev\">
47 $dev </td
><td
>$size</td
><td
>$model</td
><td
><font color
=red
>"正在使用"</font
></td
></tr>"
48 elif cat /proc/swaps | grep -q $dev; then
49 echo "<tr bgcolor
="#c6d5a8" align
="center"><td
><input
type=\"checkbox
\" name
=\"devs_
$count\" value
=\"$dev\">
50 $dev </td
><td
>$size</td
><td
>$model</td
><td
><font color
=red
>"使用\(swap\)"</font
></td
></tr>"
52 echo "<tr bgcolor
="#c6d5a8" align
="center"><td
><input
type=\"checkbox
\" name
=\"devs_
$count\" value
=\"$dev\">
53 $dev </td
><td
>$size</td
><td
>$model</td
><td
>"未使用"</td
></tr>"
58 echo "</table
><br
><br
><hr
>"
65 <div class="messageblock messageblock-info
">
66 <div class="messageblock-internal
">
67 <p> 热备盘是未被使用的空闲硬盘。在Raid阵列中若有磁盘失效,系统会自动用热备盘替换,以确保数据安全性.<br>
68 提示:热备盘必须是空闲硬盘,上面创建Raid的硬盘不能被使用.</p>
70 <select name="hot_spare
" >
72 devs="<option value
=\"no
\">无热备盘
</option
>"
75 dev=$(echo $line | cut -f1 -d:)
76 devs="$devs <option value
=$dev>$dev</option
>"
83 <input type="submit
" value="创建阵列
")