From f2cad7693c61dd222776a1852fab5ea9c81c6af0 Mon Sep 17 00:00:00 2001 From: Eli Bosley Date: Wed, 10 Sep 2025 09:18:50 -0400 Subject: [PATCH] feat: Implement deprecated filesystem detection and warnings for array and cache devices - Added a shared function to check for deprecated filesystems (ReiserFS and XFS v4) across array and cache devices. - Updated ArrayDevices.page and CacheDevices.page to display warnings for deprecated filesystems. - Introduced helper functions for generating filesystem warning icons and messages. --- emhttp/plugins/dynamix/ArrayDevices.page | 6 + emhttp/plugins/dynamix/CacheDevices.page | 8 ++ emhttp/plugins/dynamix/include/Helpers.php | 147 +++++++++++++++++++++ 3 files changed, 161 insertions(+) diff --git a/emhttp/plugins/dynamix/ArrayDevices.page b/emhttp/plugins/dynamix/ArrayDevices.page index 1a9edc4cf..b3426d206 100644 --- a/emhttp/plugins/dynamix/ArrayDevices.page +++ b/emhttp/plugins/dynamix/ArrayDevices.page @@ -15,6 +15,9 @@ Cond="(_var($var,'SYS_ARRAY_SLOTS') > 0 || $var['fsState']=='Stopped')" * all copies or substantial portions of the Software. */ $power = _var($display,'power') && in_array('nvme',array_column(main_filter($disks),'transport')) ? _('Power').' / ' : ''; + +// Check for deprecated filesystems using shared function +$deprecatedDisks = check_deprecated_filesystems_array($disks, 'main_filter'); ?> + + +
@@ -171,6 +177,8 @@ $root = explode($_tilde_,$pool)[0];
+ + :cache_devices_help: diff --git a/emhttp/plugins/dynamix/include/Helpers.php b/emhttp/plugins/dynamix/include/Helpers.php index 5e4d1825a..31a0df506 100644 --- a/emhttp/plugins/dynamix/include/Helpers.php +++ b/emhttp/plugins/dynamix/include/Helpers.php @@ -297,6 +297,60 @@ function urlencode_path($path) { return str_replace("%2F", "/", urlencode($path)); } +function check_deprecated_filesystem($disk) { + $fsType = _var($disk, 'fsType', ''); + $name = _var($disk, 'name', ''); + $warnings = []; + + // Check for ReiserFS + if (stripos($fsType, 'reiserfs') !== false) { + $warnings[] = [ + 'type' => 'reiserfs', + 'severity' => 'critical', + 'message' => _('ReiserFS is deprecated and will not be supported in future Unraid releases') + ]; + } + + // Check for XFS v4 (lacks CRC checksums) + if (stripos($fsType, 'xfs') !== false) { + // Check if disk is mounted to determine XFS version + $mountPoint = "/mnt/$name"; + if (is_dir($mountPoint) && exec("mountpoint -q " . escapeshellarg($mountPoint) . " 2>/dev/null", $output, $ret) && $ret == 0) { + // Check for crc=0 which indicates XFS v4 + $xfsInfo = shell_exec("xfs_info " . escapeshellarg($mountPoint) . " 2>/dev/null"); + if ($xfsInfo && strpos($xfsInfo, 'crc=0') !== false) { + $warnings[] = [ + 'type' => 'xfs_v4', + 'severity' => 'critical', + 'message' => _('XFS v4 is deprecated and will not be supported in future Unraid releases. Please migrate to XFS v5 immediately') + ]; + } + } + } + + return $warnings; +} + +function get_filesystem_warning_icon($warnings) { + if (empty($warnings)) return ''; + + $hasCritical = false; + $messages = []; + + foreach ($warnings as $warning) { + if ($warning['severity'] == 'critical') { + $hasCritical = true; + } + $messages[] = $warning['message']; + } + + $icon = $hasCritical ? 'exclamation-triangle' : 'exclamation-circle'; + $color = $hasCritical ? 'red-text' : 'orange-text'; + $tooltip = implode('. ', $messages); + + return " "; +} + function pgrep($process_name, $escape_arg=true) { $pid = exec('pgrep --ns $$ '.($escape_arg ? escapeshellarg($process_name) : $process_name), $output, $retval); return $retval == 0 ? $pid : false; @@ -604,4 +658,97 @@ function clone_list($disk) { global $pools; return strpos($disk['status'],'_NP') === false && ($disk['type'] == 'Data' || in_array($disk['name'], $pools)); } + +// Deprecated filesystem detection and display functions +function check_deprecated_filesystems_array($disks, $filter_function) { + $deprecated = []; + + foreach ($filter_function($disks) as $disk) { + if (substr($disk['status'],0,7) != 'DISK_NP') { + $fsType = strtolower(_var($disk, 'fsType', '')); + + // Check for deprecated filesystems + if (strpos($fsType, 'reiserfs') !== false) { + $deprecated[] = [ + 'name' => $disk['name'], + 'fsType' => 'ReiserFS', + 'message' => 'ReiserFS is deprecated and will not be supported in future Unraid releases' + ]; + } + + // Check for XFS v4 (lacks CRC checksums) + if (strpos($fsType, 'xfs') !== false) { + $name = $disk['name']; + $mountPoint = "/mnt/$name"; + + // Check if disk is mounted + if (is_dir($mountPoint)) { + exec("mountpoint -q " . escapeshellarg($mountPoint) . " 2>/dev/null", $output, $ret); + if ($ret == 0) { + // Get XFS info to check for crc=0 which indicates XFS v4 + $xfsInfo = shell_exec("xfs_info " . escapeshellarg($mountPoint) . " 2>/dev/null"); + if ($xfsInfo && strpos($xfsInfo, 'crc=0') !== false) { + $deprecated[] = [ + 'name' => $disk['name'], + 'fsType' => 'XFS v4', + 'message' => 'XFS v4 is deprecated and will not be supported in future Unraid releases. Please migrate to XFS v5' + ]; + } + } + } + } + } + } + + return $deprecated; +} + +function display_deprecated_filesystem_warning($deprecated_disks, $type = 'array') { + if (empty($deprecated_disks)) return ''; + + $id = $type === 'array' ? 'array-deprecated-warning' : 'pool-deprecated-warning'; + $title = htmlspecialchars($type === 'array' ? 'Deprecated Filesystem Warning' : 'Deprecated Pool Filesystem Warning'); + $description = htmlspecialchars($type === 'array' ? + 'The following array devices are using deprecated filesystems:' : + 'The following pool devices are using deprecated filesystems:'); + + // Build the disk list + $diskList = ''; + foreach ($deprecated_disks as $disk) { + $name = htmlspecialchars($disk['name']); + $fsType = htmlspecialchars($disk['fsType']); + $message = htmlspecialchars($disk['message']); + $diskList .= "
  • {$name}: {$fsType} - {$message}
  • \n"; + } + + return << +
    + +
    + +
    +
    + {$title} +
    +
    + {$description} +
    +
      + {$diskList} +
    +
    + Action Required: Migrate to a supported filesystem (XFS v5, BTRFS, or ZFS). + View migration guide → +
    +
    +
    +
    + +HTML; +} ?>