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

Issues and / or general discussion relating to Puppy

Moderator: Forum moderators

Post Reply
dancytron
Posts: 723
Joined: Fri Dec 13, 2019 6:26 pm
Has thanked: 523 times
Been thanked: 218 times

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

Post 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:

User avatar
Jafadmin
Posts: 385
Joined: Tue Aug 04, 2020 4:51 pm
Has thanked: 68 times
Been thanked: 85 times

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

Post 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!'

williwaw
Posts: 1975
Joined: Tue Jul 14, 2020 11:24 pm
Has thanked: 172 times
Been thanked: 372 times

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

Post by williwaw »

backmeup.sh

nice !

Post Reply

Return to “Users”