summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2024-01-10 14:49:35 +0100
committerSimon Rettberg2024-01-10 14:49:35 +0100
commit92ab4a1e9506b2dc1b50b44d43b31ed1f4053099 (patch)
tree17ee815be04d1ca32e7b2802384516191f26b62e
parentRemove lie from comment (diff)
downloadsystemd-init-92ab4a1e9506b2dc1b50b44d43b31ed1f4053099.tar.gz
systemd-init-92ab4a1e9506b2dc1b50b44d43b31ed1f4053099.tar.xz
systemd-init-92ab4a1e9506b2dc1b50b44d43b31ed1f4053099.zip
[dnbd3-rootfs] Try optimized ext4 mount options if none are given
-rwxr-xr-xmodules.d/dnbd3-rootfs/hooks/mount-root-device.sh19
1 files changed, 18 insertions, 1 deletions
diff --git a/modules.d/dnbd3-rootfs/hooks/mount-root-device.sh b/modules.d/dnbd3-rootfs/hooks/mount-root-device.sh
index 6f31bbac..73d947d0 100755
--- a/modules.d/dnbd3-rootfs/hooks/mount-root-device.sh
+++ b/modules.d/dnbd3-rootfs/hooks/mount-root-device.sh
@@ -1,9 +1,26 @@
type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh
source "/etc/openslx"
-mount "$SLX_DNBD3_DEVICE_COW" "$NEWROOT" $SLX_MOUNT_ROOT_OPTIONS
+ret=99
+if [ -n "$SLX_MOUNT_ROOT_OPTIONS" ]; then
+ # Always prefer mount options mandated by server
+ mount "$SLX_DNBD3_DEVICE_COW" "$NEWROOT" $SLX_MOUNT_ROOT_OPTIONS
+ ret=$?
+else
+ # Let's guess it's ext4, tune for maximum performance as we don't care about recoverability
+ mount "$SLX_DNBD3_DEVICE_COW" "$NEWROOT" -o data=writeback,barrier=0,commit=60,noinit_itable,discard,noatime
+ ret=$?
+ if (( ret != 0 )); then
+ # Just try with no options and hope for the best...
+ mount "$SLX_DNBD3_DEVICE_COW" "$NEWROOT"
+ ret=$?
+ fi
+fi
+
if [ -n "$SLX_GENERATE_FSTAB_SCRIPT" ]; then
eval "$SLX_GENERATE_FSTAB_SCRIPT"
else
echo "" > "$NEWROOT/etc/fstab"
fi
+
+return $ret