diff --git a/INSTALL/tool/VentoyWorker.sh b/INSTALL/tool/VentoyWorker.sh index e0800d98..36e2b6a0 100644 --- a/INSTALL/tool/VentoyWorker.sh +++ b/INSTALL/tool/VentoyWorker.sh @@ -314,10 +314,10 @@ if [ "$MODE" = "install" -a -z "$NONDESTRUCTIVE" ]; then wait_and_create_part ${PART1} ${PART2} if [ -b ${PART1} ]; then vtinfo "Format partition 1 ${PART1} ..." - mkexfatfs -n "$VTNEW_LABEL" -s $cluster_sectors ${PART1} + $mkexfatfs "$VTNEW_LABEL" "$cluster_sectors" ${PART1} if [ $? -ne 0 ]; then echo "mkexfatfs failed, now retry..." - mkexfatfs -n "$VTNEW_LABEL" -s $cluster_sectors ${PART1} + $mkexfatfs "$VTNEW_LABEL" "$cluster_sectors" ${PART1} if [ $? -ne 0 ]; then echo "######### mkexfatfs failed, exit ########" exit 1 diff --git a/INSTALL/tool/ventoy_lib.sh b/INSTALL/tool/ventoy_lib.sh index 710cc37f..305ef20a 100644 --- a/INSTALL/tool/ventoy_lib.sh +++ b/INSTALL/tool/ventoy_lib.sh @@ -50,6 +50,32 @@ vtoy_gen_uuid() { fi } +# Use exfatprogs instead of exfat-utils to handle exFAT filesystem operations +# https://github.com/storaged-project/udisks/issues/903 +# Kernel 5.7 and above: Install the exfatprogs package +# https://wiki.gentoo.org/wiki/ExFAT +# exfatprogs and exfat-utils packages conflict +# https://forums.fedoraforum.org/showthread.php?325580-exfatprogs-and-exfat-utils-packages-conflict&p=1844223 +mkfs_exfat_() { + local label=$1 + local sectors=$2 # sectors per block + shift 2 + mkfs.exfat -L "$label" -c "$(expr "$sectors" / 2)K" "$@" +} +mkexfatfs_() { + local label=$1 + local sectors=$2 # sectors per block + shift 2 + # mkexfatfs -n "$VTNEW_LABEL" -s $cluster_sectors ${PART1} + mkexfatfs -n "$label" -s "$sectors" "$@" +} +mkexfatfs= +if [ ! -z "$(comand -v mkfs.exfat)" ]; then + mkexfatfs=mkfs_exfat_ +elif [ ! -z "$(comand -v mkexfatfs)" ]; then + mkexfatfs=mkexfatfs_ +fi + check_tool_work_ok() { if echo 1 | hexdump > /dev/null; then @@ -60,7 +86,7 @@ check_tool_work_ok() { return fi - if mkexfatfs -V > /dev/null; then + if [ ! -z "$mkexfatfs" ]; then vtdebug "mkexfatfs test ok ..." else vtdebug "mkexfatfs test fail ..."