From 1af5c26034ee76c90444ad8ec796a4d28ed155e3 Mon Sep 17 00:00:00 2001 From: Calvin Loncaric Date: Sat, 4 May 2019 21:39:30 -0700 Subject: [PATCH] Flush disk writes before reboot This commit introduces a `sync` call before the install script exits. The writes that this script does during setup do not reach persistent storage until the kernel decides to flush them. The reboot sequence might drop those pending writes on the floor. To mitigate that possibility (but not fully eliminate it), the script now calls `sync`, which waits until the kernel has flushed its write cache. --- auto_install/install.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/auto_install/install.sh b/auto_install/install.sh index f817e45..9632e5d 100755 --- a/auto_install/install.sh +++ b/auto_install/install.sh @@ -1371,6 +1371,10 @@ main() { $SUDO systemctl start openvpn.service ;; esac + + # Ensure that cached writes reach persistent storage + echo "::: Flushing writes to disk..." + sync echo "::: done."