From 05ed400c32276fec7ecb2e79450f77bc1e8b3b8a Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Fri, 21 Oct 2022 15:57:42 +0200 Subject: [PATCH] Adapted logic for optimal blocksize --- scripts/base.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/base.sh b/scripts/base.sh index d8450f8..7d94f5b 100644 --- a/scripts/base.sh +++ b/scripts/base.sh @@ -78,9 +78,15 @@ set_device_path(){ then error "$device_path is not valid device." fi + info "Device path set to: $device_path" # @see https://www.heise.de/ct/hotline/Optimale-Blockgroesse-fuer-dd-2056768.html - OPTIMAL_BLOCKSIZE=$(expr 64 \* "$(sudo cat /sys/block/"$device"/queue/physical_block_size)") && - info "Device path set to: $device_path" && + PHYSICAL_BLOCK_SIZE_PATH="/sys/block/$device/queue/physical_block_size" + if [ -f "$device_path" ] + then + OPTIMAL_BLOCKSIZE=$(expr 64 \* "$(sudo cat $PHYSICAL_BLOCK_SIZE_PATH)") || error + else + OPTIMAL_BLOCKSIZE="1KB" + fi info "Optimal blocksize set to: $OPTIMAL_BLOCKSIZE" || error }