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.
This commit is contained in:
Calvin Loncaric 2019-05-04 21:39:30 -07:00
parent 2c82a83894
commit 1af5c26034
No known key found for this signature in database
GPG key ID: 56985970B4C91177

View file

@ -1371,6 +1371,10 @@ main() {
$SUDO systemctl start openvpn.service $SUDO systemctl start openvpn.service
;; ;;
esac esac
# Ensure that cached writes reach persistent storage
echo "::: Flushing writes to disk..."
sync
echo "::: done." echo "::: done."