Thursday, February 11, 2010

Example Full/Incremental Script

SkyHi @ Thursday, February 11, 2010
  • Typical list of directories you WANT to backup regularly...
    • DIRS is typically: /root /etc /home/

  • Using Month/Date for Backup Filenames
  • Simple Full Backup
    • tar zcvf /Backup_Dir/Month_Date.Full.tgz $DIRS

  • Simple Incremental Backups
    • Change the Month_Date.tgz file
    • Backup the files to a Different Server:/Disks [ reasons ]

    • Simple Daily Incremental Backup
      find $DIRS -mtime -1 -type f -print | tar zcvf /BackupDir_1/Month_Date.tgz -T -

    • Simple Weekly Incremental Backup
      find $DIRS -mtime -7 -type f -print | tar zcvf /BackupDir_7/Month_Date.7.tgz -T -
        use -mtime -32 to cover for un-noticed failed incremental backups from last week

    • Simple Monthly Incremental Backup
      find $DIRS -mtime -31 -type f -print | tar zcvf /BackupDir_30/Year_Month.30.tgz -T -
        use -mtime -93 to cover for un-noticed failed incremental backups from last month

  • The MAJOR problem with "daily" incremental backups methodology"
    • If one of the ( todays ) daily backup files was bad, for any reason
      • than you dont have backup for "today"
      • all subsequent ( tommorrow, next day ) backups are basically unsusable
      • you cannot restore your system from backups -- you are missing files from "today"

    • If one of the weekly backup files was bad, for any reason
      than all subsequent backups are basically unsusable, till the next 30 day incremental backup

  • The solution is to always perform incremental backup since the last full backup
    • in the option -mtime $Cnt the counter would increment daily

    • incremental backups should always start from the last "FULL" backup and changes till today


  • REFERENCE
    http://www.linux-backup.net/Full_Inc/