add syncs to avoid fs issues

This commit is contained in:
Tobias Powalowski 2024-07-12 09:50:49 +02:00
parent d398e5f674
commit 12c06d228c
3 changed files with 5 additions and 2 deletions

View file

@ -99,9 +99,10 @@ for i in bcachefs btrfs ext4 swap vfat xfs; do
else
mkfs.${i} /test.img &>"${_NO_LOG}" ||\
echo "Creation error: ${i}" >> filesystems-error.log
mount -o loop /test.img /mnt &>"${_NO_LOG}" ||\
sync
mount /test.img /mnt &>"${_NO_LOG}" ||\
echo "Mount error: ${i}" >> filesystems-error.log
umount /mnt || echo "Unmount error: ${i}" >> filesystems-error.log
umount /mnt &>"${_NO_LOG}" || echo "Unmount error: ${i}" >> filesystems-error.log
fi
done
_result filesystems-error.log

View file

@ -274,6 +274,7 @@ _clean_disk() {
wipefs -a -f "${1}" &>"${_NO_LOG}"
# really clear everything MBR/GPT at the beginning of the device!
dd if=/dev/zero of="${1}" bs=1M count=10 &>"${_NO_LOG}"
sync
}
# Disable swap and all mounted partitions for the destination system. Unmount

View file

@ -490,6 +490,7 @@ _mkfs() {
vfat) mkfs.vfat -F32 ${7} -n "${6}" ${1} &>"${_LOG}" || : >/tmp/.mp-error ;;
xfs) mkfs.xfs ${7} -L "${6}" -f ${1} &>"${_LOG}"|| : >/tmp/.mp-error ;;
esac
sync
if [[ -f "/tmp/.mp-error" ]]; then
_progress "100" "ERROR: Creating filesystem ${2} on ${1}" 0 0
sleep 5