On Sat, Aug 08, 2020 at 02:53:13PM +0100, g4sra via Dng wrote:
> On 07/08/2020 21:01, Haines Brown wrote:
> > On Fri, Aug 07, 2020 at 06:34:04PM +0100, g4sra wrote:
> >
> >> Post your backup script for others to look over.
> >
> >
> > #!/bin/bash
> > a="============================================="
> > b="Start: "
> > c=$(date)
> > mount /mnt/backup &
> ^^^^^^^^^^^^
> 1) Don't do this in the background, script execution will proceed straight into the 'find' command below before the mount is ready.
Indeed, I think that has happened upon occassion (backup to mount
point rather than to backup drive).
> 2) Ensure you are mounting using 'ntfs-3g' or you will get a large performance hit and unsafe writes (last time I checked the Docs).
> E.g. /etc/fstab
> /dev/XXX /mnt/backup ntfs-3g defaults 0 0
> Or in the script
> 'ntfs-3g /dev/XXX /mnt/backup
I changed from ntfs to ftfs-3g in fstab, but didn't see any signficant
gain in back up speed. However the script no longer hangs if if finds
the drive already mounted. It complains but proceeds with the backup.
>
> 3) abort if the mount fails
> [ $? -eq 0 ] || {echo "Mount Failed!"; exit 1;}
I put this line into my backup script and only got a syntax error.
> > find /mnt/backup/20* -maxdepth 0 -type d | sort -n | head -n 1 | xargs rm -rfv
> > sleep 3s
> > dirName=`date +%Y.%m.%d`
> > mkdir /mnt/backup/"$dirName"
> > find / -print | egrep "^/mnt^/var^/mail|^/home|^/etc|^/opt|^/storage|^/info|^/usr/local" | cpio -pdmuv /mnt/backup/"$dirName" 2>&1 | cat -vT
> > d="End:"
> > e=$(date +%H:%M:%S)
> > f="Disk used: "
> > g=`df /mnt/backup | tail -n 1 | awk '{print $5}'`
> > printf "$a \n $b $c \n $d $e \n $f %s\n" "$g" >> /home/haines/.backup.log
>
> You are backing up files that have not changed since the last backup.
> Do you really need all of that kerfuffle ?
The only price paid for the "kerfuffle" is the expense of a large
backup disk and the extra time that a backup takes in the backgroundñ.
In the past (back in my OS/2 days) I did incremental backups, but
since then like easy access to files that have not changed. Of course
the majority of people are not inclinded to see thigs this way.
--
Haines Brown