Skip to content

Commit

Permalink
[installer]: Umount before delete partition (#1575)
Browse files Browse the repository at this point in the history
Signed-off-by: Qi Luo <qiluo-msft@users.noreply.github.com>
  • Loading branch information
qiluo-msft authored and lguohan committed Apr 10, 2018
1 parent af0013e commit c29def6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion installer/x86_64/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,21 @@ create_demo_gpt_partition()
while read -r part_index; do
if [ "$blk_dev$part_index" = "$cur_part" ]; then continue; fi
echo "deleting partition $part_index ..."
# if the partition is already mounted, umount first
df $blk_dev$part_index 2>/dev/null && {
umount $blk_dev$part_index || {
echo "Error: Unable to umount $blk_dev$part_index"
exit 1
}
}
sgdisk -d $part_index $blk_dev || {
echo "Error: Unable to delete partition $part_index on $blk_dev"
exit 1
}
partprobe
partprobe || {
echo "Error: Unable to partprobe"
exit 1
}
done < $tmpfifo
fi

Expand Down

0 comments on commit c29def6

Please sign in to comment.