Thanks to visit codestin.com
Credit goes to github.com

Skip to content

mkorthof/acronis-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

Acronis CLI

Wrapper batch script for Acronis True Image (Home) and Single version Backup Scheme

This script first checks if there's enough free disk space and deletes the oldest ".tib" file(s) if needed. Then it runs True Image with the most recent settings (using ".tis" file).

Where:

  • "TI" is Acronis True Image (program)
  • ".tib" is True Image Backup (image)
  • ".tis" is True Image Script (XML)

Why❔

The reasoning behind this is that I backup (full) to an offline external hd which is only powered on during backup. After backup finishes, the PC hibernates by using shutdown /h as Post-command option in True Image. I wanted something to trigger backup instead of TI GUI or it's scheduler, and made this wrapper script.

However, now TI kept filling up the drive, which is why there's an option to delete oldest image.

If you (want to) do the same, this script could be useful for you :)

It's written as a single Batch file for simplicity. It does not depend on anything else (besides Acronis TI) and should run on (most) Windows systems.

🗃 Backup Scheme

In the True Image GUI, set scheme and other settings first . This will automatically create a ".tis" file.

Make sure to select 'Single version Backup Scheme' in True Image settings:

The program creates a full backup version and overwrites it every time according to the specified schedule or when you run the backup manually. In this process, the old version is deleted only after a new version is created.

For more details see User Guide, Single version scheme

💻 Usage

Now you can run acronis.bat from CLI as Administrator. Either from the Command Prompt (CTRL+R, cmd.exe, ALT+ENTER) or PowerShell.

Using the -s option does not delete or run anything, it displays free space and .tib file size and TI details only.

Without arguments: start the backup and remove both oldest TIB and run True Image backup.

To specify target drive dir and free space in MB: acronis.bat -d F:\AcronisBackup -f 500000

To remove oldest TIB only and not run backup, use -o option. Could possibly also be used as pre-script in TI (untested)

⚙ Configuration

To permanently change settings, edit acronis.bat file:

  • Required free space:

    • SET /A REQ_FREE=500000 (default is 500GB)

    Set minimal needed free space to at least the size of one '.tib' file

  • Backup Drive letter and directory:

    • SET "BKP_DRIVE=F" (default is 'F')
    • SET "BKP_DIR=AcronisBackup (default is 'AcronisBackup')
  • Mode (optional):

    • SET /A MODE=1 delete oldest image specified in .tis script (default mode)
    • SET /A MODE=2 deletes oldest images until there's enough free space
    • SET /A DEL_MAX_FILES=3 (default is '3')

Mode 2 is useful if deleting only the oldest image does not free up enough disk space set by REQ_FREE.

Note that Mode 2 keeps deleting images until there's enough free disk space, or stops when DEL_MAX_FILES are deleted.

🙋‍♂️ Help

All available actions and options:

C:\❯ acronis.bat -h

Acronis CLI

USAGE: acronis.bat [-h|-l|-o|-s|-v] [-d|-f|-m|-x|-n]

  ACTIONS

       -h   help
       -l   view last log file
       -o   remove oldest image if needed and exit
       -s   show backup drive and disk space
       -v   view script

       default: if no action is specified, del oldest image
                image and start backup by running TI as Admin

  OPTIONS

       [-d <path>] set backup drive and path
       [-f <size>] set required free space on drive in MB
       [-m <num>]  set mode 1 or 2
       [-x <num>]  set max backups to delete
       [-n] do not start post/after command 

EXAMPLE: acronis.bat -d F:\AcronisBackup -f 500000 -x 3

See inside script for default settings

Troubleshooting

Backup does not start:

  • Make the backp disk is available and has enough disk space (acronis.bat -s)
  • Scan backup disk for filesystem errors

Backup never finishes:

  • The script might hang waiting acronis ti process
  • Check the latest log file (acronis.bat -l) file for errors
  • Check status in Acronis TI GUI

Check backup script (acronis.bat -v) and/or config in the GUI e.g. volumes and paths

📝 More info

Releases

No releases published

Packages

No packages published