HOWTO: Display Raid rebuild ETA on the Raid5 | Information page

Have you ever had a situation when your RAID has degraded and had to be rebuild? Does it take a long time and you don't know exactly how long rebuilding will take without access to the console?

Well, I have found a way to display this information in the Disk | Software RAID | RAID5 | Information.

Here's what you do:
1) log in to your FreeNAS console (physical or SSH into it)
2) Navigate to www:

cd /usr/local/www/

3) edit disks_raid_graid5_info.php

nano disks_raid_graid5_info.php

4) Find this block:

foreach ($rawdata as $line) {
echo htmlspecialchars($line) . "<br>";
unset ($line);

5) Replace

echo htmlspecialchars($line) . "<br>";


echo htmlspecialchars($line);
if (strpos($line, "REBUILDING") !== false) {
  $cmd = "/sbin/dmesg | tail -1 | awk '{print substr($0, index($0, \"ETA:\"), length($0))}'";
  $eta = trim(shell_exec($cmd));
  echo " " . htmlspecialchars($eta);
echo "<br>";

If you have other RAID types on your system, other than RAID5, you can apply this procedure to other disks_*_info.php