Page 1 of 1

rsync as backup when you forget to mount the partition being backed up

Posted: Sun Apr 16, 2023 12:42 pm
by dancytron

If you use rsync to do an incremental backup of a partition and you forget to mount it, such as:

Code: Select all

rsync -ai --progress --delete /mnt/sda8/ /mnt/sdb3

it will DELETE all the files on the backup. :shock:

Mount it and run it again and it will copy back the 40 gig of stuff it just deleted. :oops:


Re: rsync as backup when you forget to mount the partition being backed up

Posted: Sun Apr 16, 2023 6:21 pm
by Jafadmin

backmeup.sh

Code: Select all

#! /bin/bash
:<<'[#####]'

	rsync to /mnt/sda8

	rsync -avu --delete "$SOURCE" "$DESTINATION"

[#####]

if [ -z "$(mount | grep -i /mnt/sda8)" ]; then

    zenity --info --timeout=10 --title="Sync2Backup"  --text="sda8 not mounted .." &
    exit
fi
#--  rsync  ----- From: ___________ To:
rsync -avu --delete /stuff/to/backup /mnt/sda8/backup/destination
sync
echo "Backup Complete $(date)" > $HOME/sync2backup.out
notify-send 'Sync Complete!' 'Have a nice day!'


Re: rsync as backup when you forget to mount the partition being backed up

Posted: Mon Apr 17, 2023 12:47 am
by williwaw

backmeup.sh

nice !