Update backup-files.sh

Already mount disk error fixed
This commit is contained in:
Facundo Carroz 2025-10-10 18:19:39 -03:00 committed by GitHub
parent 1e91bbdd45
commit b9c8235955
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -54,13 +54,19 @@ if [ ! -d "$backup_path" ]; then
echo "Mount point disk created"
fi
# Mount disk
echo "Mounting disk..."
mount UUID="$disk_UUID" "$backup_path"
if mountpoint -q "$backup_path"; then
echo "$backup_path is already mounted."
mounted_src=$(findmnt -n -o SOURCE --target "$backup_path" 2>/dev/null || true)
echo "Mounted source: ${mounted_src:-unknown}"
else
echo "Mounting disk..."
if ! mount UUID="$disk_UUID" "$backup_path"; then
echo "mount returned non-zero. Checking mountpoint..."
fi
fi
# The disk not mount
# Check the disk not mount
if ! mountpoint -q "$backup_path"; then
echo "Error occurred when mounting disk. Aborting..."
exit 1