--- /dev/null
+#!/bin/bash
+
+# Original source:
+# https://github.com/exfatprogs/exfatprogs/blob/1.2.4/.github/workflows/c-cpp.yml#L37
+
+set -e
+
+mkdir "${AUTOPKGTEST_TMP}/mnt"
+truncate -s 10G "${AUTOPKGTEST_TMP}/test.img"
+
+dev=$(losetup --show -f "${AUTOPKGTEST_TMP}/test.img")
+mkfs.exfat ${dev}
+
+mount -t exfat ${dev} "${AUTOPKGTEST_TMP}/mnt"
+cd "${AUTOPKGTEST_TMP}/mnt"
+
+i=1;while [ $i -le 10000 ];do touch file$i;if [ $? != 0 ]; then exit 1; fi; i=$(($i + 1));done
+sync
+rm -rf *
+
+i=1;while [ $i -le 10000 ];do mkdir dir$i;if [ $? != 0 ]; then exit 1; fi; i=$(($i + 1));done
+sync
+rm -rf *
+
+i=1;while [ $i -le 10000 ];do touch file$i;if [ $? != 0 ]; then exit 1; fi; i=$(($i + 1));done
+i=1;while [ $i -le 10000 ];do mkdir dir$i;if [ $? != 0 ]; then exit 1; fi; i=$(($i + 1));done
+sync
+
+fsck.exfat ${dev}
+find . -delete
+fsck.exfat ${dev}
+
+cd -
+umount ${dev}
+losetup -d ${dev}