Skip I/O scheduler optimization for Btrfs filesystems (openSUSE default)
This commit is contained in:
@@ -41,9 +41,13 @@ EOF
|
|||||||
# Apply kernel parameters
|
# Apply kernel parameters
|
||||||
sudo sysctl -p
|
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 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 [[ -n "$root_disk" ]] && [[ -w "/sys/block/$root_disk/queue/scheduler" ]]; then
|
||||||
if [[ "$disk_type" == "ssd" ]]; then
|
if [[ "$disk_type" == "ssd" ]]; then
|
||||||
@@ -56,6 +60,7 @@ EOF
|
|||||||
else
|
else
|
||||||
log_warning "Could not determine or access root disk scheduler. Skipping I/O optimization."
|
log_warning "Could not determine or access root disk scheduler. Skipping I/O optimization."
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Create performance monitoring script
|
# Create performance monitoring script
|
||||||
create_performance_monitor
|
create_performance_monitor
|
||||||
|
|||||||
Reference in New Issue
Block a user