Skip I/O scheduler optimization for Btrfs filesystems (openSUSE default)

This commit is contained in:
Mărcziem ™
2025-10-06 11:52:31 +02:00
parent 3344620824
commit fea282102d

View File

@@ -41,9 +41,13 @@ EOF
# Apply kernel parameters
sudo sysctl -p
# Optimize I/O scheduler for SSDs/HDDs
# Optimize I/O scheduler for SSDs/HDDs (skip for Btrfs filesystems)
local root_fs_type=$(findmnt -n -o fstype /)
if [[ "$root_fs_type" == "btrfs" ]]; then
log_info "Btrfs filesystem detected - skipping I/O scheduler optimization (Btrfs handles I/O optimization internally)"
else
local disk_type=$(lsblk -d -o name,rota | awk 'NR>1 {if($2==0) print "ssd"; else print "hdd"; exit}')
local root_disk=$(lsblk -no pkname $(findmnt -n -o source /) | head -n1)
local root_disk=$(lsblk -no pkname $(findmnt -n -o source / | sed 's/\[.*\]//') | head -n1)
if [[ -n "$root_disk" ]] && [[ -w "/sys/block/$root_disk/queue/scheduler" ]]; then
if [[ "$disk_type" == "ssd" ]]; then
@@ -56,6 +60,7 @@ EOF
else
log_warning "Could not determine or access root disk scheduler. Skipping I/O optimization."
fi
fi
# Create performance monitoring script
create_performance_monitor