The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Restoring deleted files from backup

Discussion in 'Data Protection' started by jimhermann, Jun 28, 2011.

  1. jimhermann

    jimhermann Active Member

    Joined:
    Jan 20, 2008
    Messages:
    42
    Likes Received:
    1
    Trophy Points:
    8
    CPanel Community,

    I am running daily incremental backups plus weekly and monthly backups.

    If a user deletes a file, how do I restore the file if the daily backup has already run?

    I can't find the file in the last weekly backup because it was created after the last weekly backup was created.

    I am used to creating separate daily incremental backups, so that each backup contains the files that were created or changed in the past 23-hours. CPanel seems to create only a daily full backup by making an incremental copy on top of a full copy. Deleted files appear to be removed from the daily backup.

    The same situation occurs when a user wants a database restored. The database changes every day, so the last weekly backup won't contain the recent changes and the daily backup contains the last version. The user invariably wants the next to last version.

    Thanks.

    Jim
     
  2. jimhermann

    jimhermann Active Member

    Joined:
    Jan 20, 2008
    Messages:
    42
    Likes Received:
    1
    Trophy Points:
    8
    I found the rsync options in the cpbackup script:

    my $rsyncopts = '-rlptD';

    #recusive, copy symlinks as symlinks, preserve permissions,
    #preserve times, preserve devices

    Also, the script add "--delete" to almost every usage of rsync.

    It appears to be missing -b for backups.

    Can I add it?

    Jim

    -b, --backup make backups (see --suffix & --backup-dir)
    --backup-dir=DIR make backups into hierarchy based in DIR
    --suffix=SUFFIX backup suffix (default ~ w/o --backup-dir)


    -b, --backup
    With this option, preexisting destination files are renamed as each file is transferred or
    deleted. You can control where the backup file goes and what (if any) suffix gets appended
    using the --backup-dir and --suffix options.

    Note that if you don't specify --backup-dir, (1) the --omit-dir-times option will be implied,
    and (2) if --delete is also in effect (without --delete-excluded), rsync will add a "protect"
    filter-rule for the backup suffix to the end of all your existing excludes (e.g. -f "P *~").
    This will prevent previously backed-up files from being deleted. Note that if you are supply-
    ing your own filter rules, you may need to manually insert your own exclude/protect rule some-
    where higher up in the list so that it has a high enough priority to be effective (e.g., if
    your rules specify a trailing inclusion/exclusion of '*', the auto-added rule would never be
    reached).

    --backup-dir=DIR
    In combination with the --backup option, this tells rsync to store all backups in the speci-
    fied directory. This is very useful for incremental backups. You can additionally specify a
    backup suffix using the --suffix option (otherwise the files backed up in the specified direc-
    tory will keep their original filenames).

    --suffix=SUFFIX
    This option allows you to override the default backup suffix used with the --backup (-b)
    option. The default suffix is a ~ if no --backup-dir was specified, otherwise it is an empty
    string.
     
Loading...

Share This Page