Hi,

My working data is in a directory we can refer to as A. A is on a 
removable flash store.  "du -hs /home/me/A" reports 3.0G.  I want a 
reliable backup of most files A/*.

I created a directory "Backup" on the HDD and apply this shell 
function whenever motivated.

Backup() { \
  if [ $# -gt 1 ]; then
    echo "Too many arguments.";
  else
    echo "0 or 1 arguments are OK.";
    source="/home/me/A/*";
    echo "source is $source.";
    if [ $# -eq 0 ]; then
      echo "0 arguments is OK.";
      destination=/home/me/Backup;
      echo "destination is $destination.";
    else
      echo "1 argument is OK.";
      destination=/home/me/$1;
      echo "destination is $destination.";
    fi;
      echo "Executing sync and rsync.";
      sync;
      rsync \
      --exclude='Trap*' \
      --exclude='*.mp3' \
      --exclude='*.mp4' \
      -auv $source $destination ;
     /bin/ls -ld $destination/MailMessages;
     printf "du -hs $destination => ";
     du -hs $destination;
  fi;
}

When the flash store fails, work since the last execution of Backup 
can be lost.

In case the Backup directory on the HDD is lost or I want to see an 
old file not current in A, I want backups of Backup.  This function is 
applied every week or two to write to a DVD.

FilesToDVD () { \
  printf "Insert open or new DVD-R.";
  read t;
  startPath=$PWD;
  echo "startPath is $startPath";
  source=/home/me/Backup;
  echo "source is $source";
  cd $source;
  xorriso -for_backup -dev /dev/sr0 \
          -update_r . / \
          -commit \
          -toc -check_md5 failure -- \
          -eject all ;
  cd $startPath ;
  echo "  xorriso -dev /dev/sr0 -toc            ";
  echo "  mount -o sbsector=nnnnnn  /dev/sr0 /mnt/iso            "; }
  
Finding a file as it existed months or years ago can be tedious.  For 
example, find A/MailMessages as it was at 2023.02.07.  Otherwise the 
backup system works well.

Now I have a pair of 500 GB external USB drives.  Large compared to my 
working data of ~3 GB.  Please suggest improvements to my backup 
system by exploiting these drives.  I can imagine a complete copy of A 
onto an external drive for each backup; but with most files in A not 
changing during the backup interval, that is inefficient.

Thanks,            ... Peter E.

-- 
VoIP:   +1 604 670 0140
work: https://en.wikibooks.org/wiki/User:PeterEasthope

Reply via email to