From 8333ba3126315a064481aa147e82d6fbf6cec67c Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Fri, 28 Aug 2020 01:39:27 +0700 Subject: [PATCH] Sync filesystem changes before checking partition exists (#186) --- scripts/umbrel-os/external-storage/mount | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/umbrel-os/external-storage/mount b/scripts/umbrel-os/external-storage/mount index 9eecaba..5136ef7 100755 --- a/scripts/umbrel-os/external-storage/mount +++ b/scripts/umbrel-os/external-storage/mount @@ -37,6 +37,9 @@ check_dependencies () { # Returns a list of block device paths list_block_devices () { + # We need to run sync here to make sure the filesystem is reflecting the + # the latest changes in /sys/block/sd* + sync # We use "2>/dev/null || true" to swallow errors if there are # no block devices. In that case the function just returns nothing # instead of an error which is what we want. @@ -58,6 +61,9 @@ get_block_device_model () { is_partition_ext4 () { partition_path="${1}" + # We need to run sync here to make sure the filesystem is reflecting the + # the latest changes in /dev/* + sync blkid -o value -s TYPE "${partition_path}" | grep --quiet '^ext4$' }