Keeping Multiple Images on the Same Drive

Discussion in 'Acronis True Image Product Line' started by CAOgdin, Mar 5, 2007.

Thread Status:
Not open for further replies.
  1. CAOgdin

    CAOgdin Registered Member

    Joined:
    Nov 1, 2004
    Posts:
    87
    Recently, a client challenged me to come up with a better way to store Images for backup. I created the following strategy:

    1. All computers write ATI output to their local hard drives (in a unique partition, so it doesn't get archived again in the next scheduled run of ATI).

    2. That drive has an \Archive directory, where yesterday's ATI output will be stored.

    3. ATI output goes to the root of the drive.

    4. There is a "Pre-" command in the ATI Tools | Options that runs a simple batch file to move the previous day's ATI output to the \Archive directory (and deletes the prior day's older version).

    5. At the end of the ATI run, another script (A Windows batch file) runs as a "Post-" command to copy the most-recently created ATI output to another computer, using a shared drive.

    6. Once a week, we run a simple backup-to-tape (without compression :) ) to copy all the computer's most-recent archives on the central computer, so we can have off-site storage of all computers' ATI outputs.

    In general, if we lose a computer or hard drive, it will cost us one day's production to restore that computer with the latest image (after, of course, fixing the underlying hardware problem(s)). If, for some reason, the building burned down, we'd lose--at most--a weeks worth of work for all computers. You can change these time intervals to get as much or as little business continuity protection as you'd like.

    In the scripts attached, "Central" is the central computer where other computers (and "Central") store their ATI output on a single partition...that partition is shared out under the name "TrueImages". So, you can map to \\Central\TrueImages for another computer to copy images to the central repository. "Central" could be an old, leftover, obsolete computer running any OS capable of using SMB Sharing (e.g., Windows, or Linux with SMB).

    You will have to modify the following script to suit your own environment on each computer, then refer to it from the "Pre-" command in Tools | Options:

    @Echo off
    REM Computer on which this script may be run (otherwise, report why it won't run)
    set Name=******
    if not [%Name%] == [%computername%] goto Prohibit

    REM This script runs BEFORE TrueImage creates the *.tib file(s)

    REM Where local TrueImages are kept
    set TI=X:
    set Name=%computername%*.tib
    REM Where Truelmage Prior copies are stored (subdirectory)
    set Prior=Archive
    REM Uncomment below to debug (will echo commands, instead of executing)
    REM set action=echo WILL && Echo on

    REM This script is invoked from Acronis Truelmage BEFORE the image is
    REM made. It will delete the prior image, or migrate it to an archive
    REM folder, if one exists (and replacing any prior image there).
    REM The requirement is that when Acronis Truelmage job is created, the
    REM computer name must be the first characters of the file name.

    REM Prepare for the TrueImage creation

    REM Decide which function to perform (nothing, delete, or archive)
    set Message=did not exist
    if not exist "%TI%\%Name%" goto Report

    if not exist "%TI%\%Prior%" goto Kil101d
    REM subdirectory for holding immediate prior Truelmage exists
    set Message=was archived
    REM Flush even older archive files
    if exist "%TI%\%Prior%\%Name%" %action% del /q "%TI%\%Prior%\%Name%"
    REM Archive the most recent Truelmage
    %action% move "%TI%\%Name%" "%TI%\%Prior%"
    goto Report

    :Kil101d
    REM No place to save a prior copy, so just delete it
    set Message=was deleted
    %action% del /q "%TI%\%Name%"

    :Report
    echo %DATE% @ %TIME%: Preparing to backup "%Name%." A prior edition %Message% >>ArchiveTrueImage.log
    goto Fini

    :prohibit
    echo This script may only execute on %Name%.
    pause

    :Fini
    set TI=
    set Name=
    set action=
    set Message=
    set Prior=

    exit 0


    Now, if this is a remote computer (one that will be transferring it's results to "Central"), add this as a "Post-" command:

    @Echo off
    REM Computer on which this script may be run (otherwise, report why it won't run)
    set Name=*******
    if not [%Name%] == [%computername%] goto Prohibit

    REM This script runs AFTER TrueImage creates the *.tib file(s)

    REM Assert: We're on the proper computer (executing this on the
    REM wrong computer could cause loss of data)
    REM Where local TrueImages are kept
    set FromTI=X:
    set Name=%computername%*.tib
    REM Where remote TureImages are to be copied
    set ToShare=\\Central\TrueImages
    REM Identify the temporary drive label to be used for the copy
    set ToTI=Z:

    REM Map a drive letter (%ToTI%) to the Share on the target computer
    if exist %ToTI%\ net use %ToTI% /DELETE >nul
    net use %ToTI% "%ToShare%" >nul

    REM Where Truelmage Prior copies are stored (subdirectory)
    set Prior=Archive
    REM Uncomment below to debug (will echo commands, instead of executing)
    REM set action=echo WILL && Echo on

    REM Assert: Everything is configured; start working.

    REM This script is invoked from Acronis Truelmage AFTER the image has
    REM been made. It will copy the new archive from %FromTI% to
    REM the %ToTI% share. If it is already occupied by a prior image,
    REM and there is a %Prior% folder, it will be moved, displacing the
    REM even older image there.
    REM The requirement is that when Acronis Truelmage job is created, the
    REM computer name must be the first characters of the file name.

    REM Prepare for the Copy

    if not exist "%FromTI%\%Name%" goto DoNothing

    REM Decide which function to perform (nothing, delete, or archive)
    set Message=did not exist
    if not exist "%ToTI%\%Name%" goto DoCopy

    REM Assert: There is a prior image, appropriately named, where we
    REM plan to copy to.
    if not exist "%ToTI%\%Prior%" goto Kil101d
    REM Assert: There IS a folder where the immediate prior copy is held
    set Message=was archived
    REM Purge even older archive file(s), if one or more exist
    if exist "%ToTI%\%Prior%\%Name%" %action% del /q "%ToTI%\%Prior%\%Name%"
    REM Move the previously-saved image to the %Archive% folder
    %action% move "%ToTI%\%Name%" "%ToTI%\%Prior%"
    goto DoCopy

    :Kil101d
    REM Assert: There is no %ToTI%\%Archive% folder
    REM Just delete the prior image
    set Message=was deleted
    %action% del /q "%ToTI%\%Name%"

    :DoCopy
    xcopy /C /Q /H /R /K /Y /Z "%FromTI%\%Name%" "%ToTI%"

    :Report
    echo %DATE% @ %TIME%: Copied "%Name%" to "%ToShare%". A prior edition on %ToTI% %Message%. >>"%ToTI%\ArchiveTrueImage.log"
    goto CleanUp

    :DoNothing
    echo %DATE% @ %TIME%: Nothing at "%FromTI%\%Name%" to copied. >>"%ToTI%\ArchiveTrueImage.log"

    :CleanUp
    REM Free up the drive leter used during the copy
    net use %ToTI% /DELETE >nul
    goto Fini

    :prohibit
    echo This script may only execute on %Name%.
    pause

    :Fini

    pause

    set TI=
    set Name=
    set action=
    set Message=
    set Prior=
    set ToTI=
    set ToShare=

    exit 0


    These scripts are a "work in progress." I know they work on Windows 2000 and Windows XP, with both ATI Workstation 9 and ATI Home 10. They're released under no copyright whatsoever, and I accept no liability for your use of them. I only ask that as you improve on these scripts (or find problems in them), you post your contributions to improving them in this thread.
     
Thread Status:
Not open for further replies.