From b9c823595540d1b609ed4cde4384e23dd3834c9a Mon Sep 17 00:00:00 2001 From: Facundo Carroz Date: Fri, 10 Oct 2025 18:19:39 -0300 Subject: [PATCH] Update backup-files.sh Already mount disk error fixed --- backup-files.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/backup-files.sh b/backup-files.sh index b63c8de..048859a 100755 --- a/backup-files.sh +++ b/backup-files.sh @@ -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