From de576db3c225723542b48e2b470693bfe9f4dfb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Cami?= Date: Sat, 16 Dec 2017 23:21:07 +0100 Subject: [PATCH] call fsfreeze(8) on /boot to flush initramfs data & metadata to media --- dracut.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dracut.sh b/dracut.sh index 635fdb1c..26877060 100755 --- a/dracut.sh +++ b/dracut.sh @@ -1828,8 +1828,13 @@ fi command -v restorecon &>/dev/null && restorecon -- "$outfile" if ! sync "$outfile" 2> /dev/null; then - dinfo "dracut: sync operartion on newly created initramfs $outfile failed" + dinfo "dracut: sync operation on newly created initramfs $outfile failed" exit 1 +# use fsfreeze only if we're not writing to / +elif ! [ "$(stat -c %m -- "$outfile")" == "/" ]; then + if ! $(fsfreeze -f $(dirname "$outfile") 2>/dev/null && fsfreeze -u $(dirname "$outfile") 2>/dev/null); then + dinfo "dracut: warning: could not fsfreeze $(dirname "$outfile")" + fi fi exit 0