From f2cad7693c61dd222776a1852fab5ea9c81c6af0 Mon Sep 17 00:00:00 2001 From: Eli Bosley Date: Wed, 10 Sep 2025 09:18:50 -0400 Subject: [PATCH 1/6] 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; +} ?> From 5551dd5f98c658e63ef52eb88d0475b8032f2ac0 Mon Sep 17 00:00:00 2001 From: Eli Bosley Date: Fri, 12 Sep 2025 14:44:45 -0400 Subject: [PATCH 2/6] refactor: Enhance filesystem warning handling and display - Replaced deprecated filesystem warning logic with a shared helper function for better maintainability. - Updated DeviceInfo.page to utilize the new helper for displaying filesystem warnings. - Improved the display of critical and notice warnings for deprecated filesystems, including session-based dismissal for notices. --- emhttp/plugins/dynamix/DeviceInfo.page | 5 +- emhttp/plugins/dynamix/include/Helpers.php | 205 ++++++++++++++++----- 2 files changed, 165 insertions(+), 45 deletions(-) diff --git a/emhttp/plugins/dynamix/DeviceInfo.page b/emhttp/plugins/dynamix/DeviceInfo.page index 0aae99cad..5e137ef24 100644 --- a/emhttp/plugins/dynamix/DeviceInfo.page +++ b/emhttp/plugins/dynamix/DeviceInfo.page @@ -907,7 +907,10 @@ _(File system type)_: - style="display:none"> _(ReiserFS is deprecated)_! + diff --git a/emhttp/plugins/dynamix/include/Helpers.php b/emhttp/plugins/dynamix/include/Helpers.php index 31a0df506..a94ad34c1 100644 --- a/emhttp/plugins/dynamix/include/Helpers.php +++ b/emhttp/plugins/dynamix/include/Helpers.php @@ -660,43 +660,87 @@ function clone_list($disk) { } // Deprecated filesystem detection and display functions + +// Core function to check a single disk for deprecated filesystems +function check_disk_for_deprecated_fs($disk) { + $deprecated = []; + $fsType = strtolower(_var($disk, 'fsType', '')); + + // TEST MODE: Enable by setting query parameter ?test_fs_warnings=1 + $testMode = isset($_GET['test_fs_warnings']) && $_GET['test_fs_warnings'] == '1'; + + // Check for ReiserFS + if (strpos($fsType, 'reiserfs') !== false || ($testMode && (_var($disk, 'name') == 'disk1' || _var($disk, 'name') == 'cache'))) { + $deprecated[] = [ + 'name' => _var($disk, 'name'), + 'fsType' => 'ReiserFS', + 'severity' => 'critical', + '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 || ($testMode && in_array(_var($disk, 'name'), ['disk2', 'appdata']))) { + $name = _var($disk, 'name'); + $mountPoint = "/mnt/$name"; + + // In test mode, always show XFS v4 warning for disk2 and appdata pool + if ($testMode && in_array($name, ['disk2', 'appdata'])) { + $deprecated[] = [ + 'name' => $name, + 'fsType' => 'XFS v4', + 'severity' => 'notice', + 'message' => 'XFS v4 detected - You have 5 years to migrate to XFS v5' + ]; + } else if (is_dir($mountPoint)) { + // Normal detection for real XFS filesystems + 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' => $name, + 'fsType' => 'XFS v4', + 'severity' => 'notice', + 'message' => 'XFS v4 detected - You have 5 years to migrate to XFS v5' + ]; + } + } + } + } + + return $deprecated; +} + +// Generate inline warning HTML for a single disk +function get_inline_fs_warnings($disk) { + $warnings = check_disk_for_deprecated_fs($disk); + $html = ''; + + foreach ($warnings as $warning) { + if ($warning['severity'] === 'critical') { + // ReiserFS - critical warning + $html .= ' ' . + htmlspecialchars(_($warning['message'])) . ''; + } else { + // XFS v4 - notice + $html .= ' ' . + htmlspecialchars(_($warning['message'])) . ''; + } + } + + return $html; +} + +// Check array of disks for deprecated filesystems (used by Main page) 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' - ]; - } - } - } - } + $disk_warnings = check_disk_for_deprecated_fs($disk); + $deprecated = array_merge($deprecated, $disk_warnings); } } @@ -706,22 +750,37 @@ function check_deprecated_filesystems_array($disks, $filter_function) { 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:'); + // Separate warnings by severity + $critical_disks = []; + $notice_disks = []; - // 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"; + if (_var($disk, 'severity', 'critical') === 'critical') { + $critical_disks[] = $disk; + } else { + $notice_disks[] = $disk; + } } - return <<
    +
    + +
    +
    + {$title} +
    +
    + {$description} +
    +
      + {$diskList} +
    +
    + Recommendation: Plan to migrate to XFS v5, BTRFS, or ZFS within the next 5 years. + View migration guide → +
    +
    +
    +
    + + `); +} + +HTML; + } + + return $html; } ?> From f0cfe5199f3aec137933670c43a961a2098db6d0 Mon Sep 17 00:00:00 2001 From: Eli Bosley Date: Fri, 12 Sep 2025 14:45:24 -0400 Subject: [PATCH 3/6] refactor: Simplify filesystem warning checks by removing test mode logic - Removed test mode checks for deprecated filesystem warnings in the check_disk_for_deprecated_fs function. - Streamlined the logic for detecting ReiserFS and XFS v4 filesystems, enhancing code clarity and maintainability. --- emhttp/plugins/dynamix/include/Helpers.php | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/emhttp/plugins/dynamix/include/Helpers.php b/emhttp/plugins/dynamix/include/Helpers.php index a94ad34c1..c1e2a5809 100644 --- a/emhttp/plugins/dynamix/include/Helpers.php +++ b/emhttp/plugins/dynamix/include/Helpers.php @@ -666,11 +666,8 @@ function check_disk_for_deprecated_fs($disk) { $deprecated = []; $fsType = strtolower(_var($disk, 'fsType', '')); - // TEST MODE: Enable by setting query parameter ?test_fs_warnings=1 - $testMode = isset($_GET['test_fs_warnings']) && $_GET['test_fs_warnings'] == '1'; - // Check for ReiserFS - if (strpos($fsType, 'reiserfs') !== false || ($testMode && (_var($disk, 'name') == 'disk1' || _var($disk, 'name') == 'cache'))) { + if (strpos($fsType, 'reiserfs') !== false) { $deprecated[] = [ 'name' => _var($disk, 'name'), 'fsType' => 'ReiserFS', @@ -680,20 +677,12 @@ function check_disk_for_deprecated_fs($disk) { } // Check for XFS v4 (lacks CRC checksums) - if (strpos($fsType, 'xfs') !== false || ($testMode && in_array(_var($disk, 'name'), ['disk2', 'appdata']))) { + if (strpos($fsType, 'xfs') !== false) { $name = _var($disk, 'name'); $mountPoint = "/mnt/$name"; - // In test mode, always show XFS v4 warning for disk2 and appdata pool - if ($testMode && in_array($name, ['disk2', 'appdata'])) { - $deprecated[] = [ - 'name' => $name, - 'fsType' => 'XFS v4', - 'severity' => 'notice', - 'message' => 'XFS v4 detected - You have 5 years to migrate to XFS v5' - ]; - } else if (is_dir($mountPoint)) { - // Normal detection for real XFS filesystems + // 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 From f5a36c6ac18949fa1514e179c8f73f15c2780907 Mon Sep 17 00:00:00 2001 From: Eli Bosley Date: Fri, 12 Sep 2025 15:12:30 -0400 Subject: [PATCH 4/6] fix: Update XFS v4 deprecation message for clarity - Revised the warning message for XFS v4 to emphasize its deprecation and the timeline for migration to XFS v5, enhancing user understanding. --- emhttp/plugins/dynamix/include/Helpers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emhttp/plugins/dynamix/include/Helpers.php b/emhttp/plugins/dynamix/include/Helpers.php index c1e2a5809..f495ce284 100644 --- a/emhttp/plugins/dynamix/include/Helpers.php +++ b/emhttp/plugins/dynamix/include/Helpers.php @@ -692,7 +692,7 @@ function check_disk_for_deprecated_fs($disk) { 'name' => $name, 'fsType' => 'XFS v4', 'severity' => 'notice', - 'message' => 'XFS v4 detected - You have 5 years to migrate to XFS v5' + 'message' => 'XFS v4 is deprecated and will not be supported in future Unraid releases. You have ~5 years to migrate to XFS v5.' ]; } } From 9603eaa00a85e26bd2fec299712bb942d3b78b6b Mon Sep 17 00:00:00 2001 From: Eli Bosley Date: Fri, 12 Sep 2025 15:28:30 -0400 Subject: [PATCH 5/6] fix: Clarify XFS v4 deprecation timeline in warning message - Updated the deprecation message for XFS v4 to specify the migration deadline as 2030, improving user awareness and understanding of the timeline for necessary filesystem upgrades. --- emhttp/plugins/dynamix/include/Helpers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emhttp/plugins/dynamix/include/Helpers.php b/emhttp/plugins/dynamix/include/Helpers.php index f495ce284..e8c9a8cad 100644 --- a/emhttp/plugins/dynamix/include/Helpers.php +++ b/emhttp/plugins/dynamix/include/Helpers.php @@ -692,7 +692,7 @@ function check_disk_for_deprecated_fs($disk) { 'name' => $name, 'fsType' => 'XFS v4', 'severity' => 'notice', - 'message' => 'XFS v4 is deprecated and will not be supported in future Unraid releases. You have ~5 years to migrate to XFS v5.' + 'message' => 'XFS v4 is deprecated and will not be supported in future Unraid releases. You have until 2030 to migrate to XFS v5.' ]; } } From 8e5bdaae8dcb6881bd816c240b666b420ab0a1ea Mon Sep 17 00:00:00 2001 From: Eli Bosley Date: Fri, 12 Sep 2025 15:58:15 -0400 Subject: [PATCH 6/6] refactor: Improve XFS v4 notice display in filesystem warnings - Changed the XFS v4 notice from a span to a div for better styling and layout. - Removed the .notice class to prevent duplicate icons, enhancing the visual clarity of the warning message. --- emhttp/plugins/dynamix/include/Helpers.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/emhttp/plugins/dynamix/include/Helpers.php b/emhttp/plugins/dynamix/include/Helpers.php index e8c9a8cad..1e0594956 100644 --- a/emhttp/plugins/dynamix/include/Helpers.php +++ b/emhttp/plugins/dynamix/include/Helpers.php @@ -713,9 +713,10 @@ function get_inline_fs_warnings($disk) { $html .= ' ' . htmlspecialchars(_($warning['message'])) . ''; } else { - // XFS v4 - notice - $html .= ' ' . - htmlspecialchars(_($warning['message'])) . ''; + // XFS v4 - notice (without .notice class to avoid duplicate icon) + $html .= '
    ' . + ' ' . + htmlspecialchars(_($warning['message'])) . '
    '; } }