]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Sync initramfs after creation
authorAnkit Kumar <ankit@linux.vnet.ibm.com>
Mon, 7 Aug 2017 06:43:53 +0000 (12:13 +0530)
committerHarald Hoyer <harald@redhat.com>
Wed, 9 Aug 2017 10:04:16 +0000 (12:04 +0200)
If we trigger crash just after creating initramfs, sometimes it is
observed that initramfs is not written to disk causing the subsequent
boot to fail. A sync should resolve this.

Signed-off-by: Ankit Kumar <ankit@linux.vnet.ibm.com>
dracut.sh

index 44ad1d741a05ea835b1a3747c2c40e922656c862..3a136d46d4289369853b1704e5b97b06c3805cfe 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -1806,4 +1806,10 @@ fi
 
 command -v restorecon &>/dev/null && restorecon -- "$outfile"
 
+sync $outfile 2> /dev/null
+if [ $? -ne 0 ] ; then
+    dinfo "dracut: sync operartion on newly created initramfs $outfile failed"
+    exit 1
+fi
+
 exit 0