Odd Differential Image Creation Times

User discussion and information resource forum for Image products.
Post Reply
n8chavez
Posts: 6
Joined: Sat Dec 01, 2018 10:00 pm

Odd Differential Image Creation Times

Post by n8chavez »

I put this thread in here and not in the scripting section, even though I'm using IFWrotate, because I believe there is an error in IFW itself and not in the script

As the title says, my issue is with creating differential images and the odd creation times required to make them. I am using a Samsung 990 Pro, and can create a full image from my 60G of data is exactly 2 min. That is very regular; the time is always 2 min. However, when I use the IFWrotate script to create differential images the time needed to create those images fluctuates. I say fluctuates because sometimes differential images can take 20 sec and sometimes they can take 9 min, all with the data being imaged remaining the exact same. I can one one differential image right after another and have the time needed to make them vary greatly. I have "/mp /hash /usemd" switches in the IFWrotate.bat script (see below), and I still cannot see why there is such as drastic difference in creation times. I have been working with @BrianK, but neither one of us understand why this issue is there. The only thing I keep thinking is that maybe IFW is ignoring the hashes, even though it's told not to. I have tried this script with many versions of the switches and the result is always the same.

Any ideas as to why this is happening?

Thx

Code: Select all

@echo off
setlocal enableextensions enabledelayedexpansion

:: Copyright (C) 2011-2012, 2020 TeraByte Unlimited.  All rights reserved.
:: version 1.3

:: This batch file maintains multiple iterations of a particular backup.  Each
:: time the batch file is run, a backup will be created. The filename will
:: include the date and time. For example, the first time the batch file is run,
:: <file name>_2020-01-11-2315__FULL.tbi will be created.  On the next run, 
:: <file name>_2020-01-12-2315__FULL.tbi will be created. (Assuming it's run the 
:: next day at the same time.) Once the number of backups reaches the number 
:: specified, the oldest backup (or backup set) is deleted.
::
::
:: There are several settings you need to specify below.
:: Each one is preceded by the "set" command.

:: ---------------------------------------------------------------------------

:: Specify the folder where backup files will be saved. In all cases, omit the
:: trailing backslash, even for root directories (e.g. C: or D:). Folder
:: path can include spaces.
::
:: A UNC path can also be specified for this variable. NOTE: Make sure the share 
:: is accessible or IFWRotate and/or Image for Windows may not function as expected. 
:: If necessary, use the TBILogin variable below to specify the network share
:: login details. If IFWRotate cannot access the path it will be unable to count the 
:: previous image backups, which will result in only Full images being created and 
:: no images being deleted. In this case, it may be necessary to add credentials 
:: for the share to the user account running IFWRotate.
:: 
:: Example: set TBIBase=D:\My Backups
::
:: Example: set TBIBase=\\server\backups\mybackups

set TBIBase=E:\TeraByte_TBI_Backups



:: Specify the desired backup filename below. In all cases, omit
:: the file extension. Filename can include spaces. This is the "base"
:: filename used for creating the Full and Differential filenames.
::
:: Backup images will have the same "base" name as the specified TBIName value 
:: with the date, time, and "__FULL" appended (for Full images) or "_DIFF_", date,
:: and time appended (for Differential images).
::
:: Created Full image filename example: MyPC_2020-01-12-1754__FULL.tbi
::
:: Created Differential image filename example: MyPC_2020-01-12-1754_DIFF_2020-01-13-1821.tbi
:: 
:: Example: set TBIName=MyPC

set TBIName=System



:: Specify the parameters that should be used by IFW below. This is
:: where you specify the source drive and partition(s) for the backup. Do not
:: include the "/f" option. It will be included automatically.
::
:: Note: If you need to use the Image for Windows "/login" option to access a network share, 
:: use the TBILogin script variable below instead of specifying /login here.
::
:: Example: set TBIParms=/b /vb /d:w0 /hash

set TBIParms=/b /d:w1@0x1,0x2,0x3,0x4 /log:0 /comp:12 /min /enc:3 /nt /geoa2k /mp /hash /usemd


:: Specify the path to Image for Windows (imagew.exe, imagew64.exe).
:: Note: Set this path only if not using the installation (or default) path.
:: Do not include a trailing backslash. Do not include any spaces before or after the equals sign.
:: Omit quotation marks and the trailing backslash.
::
:: Example: set TBIPath=C:\Program Files (x86)\TeraByte Drive Image Backup and Restore Suite

set TBIPath=C:\Program Files\IFW



:: Specify the maximum number of Full image files to be saved. The oldest
:: Full image file (along with any associated Differential images) will be 
:: deleted when this value is exceeded. Number must be between 2 and 99.
::
:: Note: If the number of existing backup sets (Fulls or Fulls + Differentials) exceed
:: the number specified, the older sets will be deleted when a new Full is created. 
:: This may result in multiple sets being deleted. For example, if you had a previous
:: maximum of 7 and changed it to 3, the oldest sets will be deleted to bring
:: the count down to the new maximum of 3 when a new Full is created.
::
:: Example: Set TBIMaxFullCnt=10

set TBIMaxFullCnt=10



:: Specify the maximum number of Differential image backups to be created for
:: each Full backup. A setting of 0 (zero) will create only Full image backups.
:: If you want to create Differential backups, set the value to 1 or higher (max. 99).
::
:: Example: set TBIMaxDiffCnt=6

set TBIMaxDiffCnt=6



:: Specify any parameters needed when creating a Differential backup. Don't
:: include the "/b", "/base", or "/f" options as those are automatically
:: included. For example, you may want to verify the image after it's created.
::
:: Note: If you need to use the Image for Windows "/login" option to access a network share, 
:: use the TBILogin script variable below instead of specifying /login here.
::
:: Example: set TBIDifParms=/vb /hash
::

set TBIDifParms= /log:0 /comp:12 /min /enc:3 /nt /geoa2k /mp /hash /usemd


:: Specify the network login details (if needed to access a network share). Do not set
:: if network login is not required.
::
:: If you include the login details here, don't include them in TBIParms or TBIDifParms.
:: See the Image for Windows manual for details using the /login parameter.
::
:: Note: When this variable is used the script must be run with administrator privileges.
::
:: Example: set TBILogin=/login:"\\server\share*username*password"
:: Example: set TBILogin=/login:"\\BackupServer\Win10Backups*John*mypassword"

set TBILogin=



:: Specify method to use when disabling TeraByte's ProtectIt service to allow old backup
:: sets to be deleted when saved to the protected TeraByte_TBI_Backups folder.
::
:: It is only necessary to enable this option when the TBIBase variable is set
:: to a TeraByte_TBI_Backups folder (or sub-folder) and ProtectIt is enabled on the 
:: system. If this option is set, this script must be run with administrative privileges
:: (otherwise, old backup sets will not be deleted). Using TBOSDT (1) is recommended
:: as it does not require removing protection in order to delete the files. TBOSDT
:: (TeraByte OS Deployment Tool) is normally installed along with Image for Windows.
:: If TBOSDT is used, TBOSDT must be installed or tbosdtw.exe must exist in the script’s
:: folder. Additionally, the script’s folder must have write access.
:: 
:: Valid values for this option are:
:: 0 = ProtectIt not used or does not need to be disabled (default).
:: 1 = Use TBOSDT to delete files.
:: 2 = Disable ProtectIt service when deleting files then re-enable.
::
:: Example: set ProtectIt=1

set ProtectIt=0


:: ====================================================
:: Command line options for this script file
:: ====================================================
::
:: /f   Forces a new Full image to be created. Rotation rules for the
::      maximum number of Full images will still be enforced.
::
:: /d   Forces a new Differential image to be created. Using this option
::      will create a Differential image even if it will exceed the maximum
::      number specified.
::
::      Note: The Differential image will be based on the newest Full image.
::      If no Full image exists, a Full image will be created instead.
::
::

:: ###########################################################################
:: #
:: # NO CHANGES SHOULD BE NEEDED PAST THIS POINT
:: #
:: ###########################################################################

:: Check for Windows 2000 or later

if not "%OS%"=="Windows_NT" goto :NoWin

:: ---------------------------------------------------------------------------

:: Init vars

set Error=X
set Number1=X
set Number2=X
set TBICmd=X
set TBIOldest=X
set TBINewest=X

if %TBIMaxFullCnt% LSS 2 set /a TBIMaxFullCnt=2
if %TBIMaxFullCnt% GTR 99 set /a TBIMaxFullCnt=99
if %TBIMaxDiffCnt% LSS 0 set /a TBIMaxDiffCnt=0
if %TBIMaxDiffCnt% GTR 99 set /a TBIMaxDiffCnt=99

if not defined TBIBase echo No TBIBase parameter supplied.  Please edit: %0 & goto :End
if not defined TBIName echo No TBIName parameter supplied.  Please edit: %0 & goto :End
if not defined TBIParms echo No TBIParms parameter supplied.  Please edit: %0 & goto :End
if not defined TBIMaxFullCnt echo No TBIMaxFullCnt parameter supplied.  Please edit: %0 & goto :End
if not defined TBIMaxDiffCnt echo No TBIMaxDiffCnt parameter supplied.  Please edit: %0 & goto :End

if %ProtectIt% LSS 0 set /a ProtectIt=0
if %ProtectIt% GTR 2 set /a ProtectIt=0
if not exist "%windir%\System32\drivers\ProtectIt.sys" set /a ProtectIt=0

:: ---------------------------------------------------------------------------

set scriptpath=%~dp0
set scriptpath=%scriptpath:~0,-1%
cd /d "%scriptpath%"

(set reg32opt=)
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (set reg32opt=/reg:32)
set ifwexe=imagew.exe

if "%TBIPath:~0,1%"==" " (set TBIPath=)
if "%TBIPath%"=="" for /f "usebackq tokens=5,*" %%G in (`reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{47BFB85A-8D4F-4c78-95CB-12A06E0C7215}_is1" %reg32opt% 2^> nul ^| find "Inno Setup: App Path"`) do set TBIPath=%%H
if "%TBIPath%"=="" for /f "usebackq tokens=5,*" %%G in (`reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Image for Windows (V2)_is1" %reg32opt% 2^> nul ^| find "Inno Setup: App Path"`) do set TBIPath=%%H
if "%TBIPath%"=="" if "%PROCESSOR_ARCHITECTURE%"=="AMD64" set TBIPath=%ProgramFiles(x86)%\TeraByte Drive Image Backup and Restore Suite
if "%TBIPath%"=="" set TBIPath=%ProgramFiles%\TeraByte Drive Image Backup and Restore Suite
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" if exist "%TBIPath%\imagew64.exe" set ifwexe=imagew64.exe
if not exist "%TBIPath%\%ifwexe%" echo Unable to find '%ifwexe%' in the following path: & echo %TBIPath% & echo. & echo Please edit %0 and check TBIPath value. & goto :End

if %ProtectIt% NEQ 1 goto :skipTBOSDT
(set tbosdtpath=)
if "%tbosdtpath%"=="" for /f "usebackq tokens=5,*" %%G in (`reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{6F2F51C1-3DBA-437b-B43C-8B6FF8E9FEF6}_is1" %reg32opt% 2^> nul ^| find "Inno Setup: App Path"`) do set tbosdtpath=%%H\win
if "%tbosdtpath%"=="" if "%PROCESSOR_ARCHITECTURE%"=="AMD64" set tbosdtpath=%ProgramFiles(x86)%\TeraByte Drive Image Backup and Restore Suite\TeraByte OSD Tool Suite Pro\win
if "%tbosdtpath%"=="" set tbosdtpath=%ProgramFiles%\TeraByte Drive Image Backup and Restore Suite\TeraByte OSD Tool Suite Pro\win
if not exist "%tbosdtpath%\tbosdtw.exe" set tbosdtpath=%scriptpath%
if not exist "%tbosdtpath%\tbosdtw.exe" echo Unable to find 'tbosdtw.exe' & echo Make sure TBOSDT is installed or tbosdtw.exe is in script's folder. & goto :End
:skipTBOSDT

:: ---------------------------------------------------------------------------

:: Log into network share

if "%TBILogin:~0,1%"==" " (set TBILogin=)
if defined TBILogin "%TBIPath%\%ifwexe%" /log:0 /hide /quit %TBILogin%

:: Get Full image file counts

set /a Number1=0
if exist "%TBIBase%\%TBIName%_*__FULL.tbi" for /f "delims=" %%a in ('dir "%TBIBase%\%TBIName%_*__FULL.tbi" /o-d /b /p /-p /w /-w') do (set TBIOldest=%%a) & (set /a Number1=!Number1!+1) & (if "!TBINewest!"=="X" set TBINewest=%%a)
set TBIFullCnt=%Number1%
echo.
echo Number of Full images found in set: %TBIFullCnt%
if "%TBINewest%"=="X" set TBINewest=(none)
if "%TBIOldest%"=="X" set TBIOldest=(none)
echo Oldest Full image set found: %TBIOldest%
echo Newest Full image set found: %TBINewest%

:: Get Diff image file counts for newest set

set TBINewest=%TBINewest:~0,-10%
set /a Number1=0
if exist "%TBIBase%\%TBINewest%_DIFF*.tbi" for /f %%a in ('dir "%TBIBase%\%TBINewest%_DIFF*.tbi" /o-d /b /p /-p /w /-w') do (set /a Number1=!Number1!+1)
set TBIDiffCnt=%Number1%
echo.
echo Number of Differential images found in newest Full set: %TBIDiffCnt% of %TBIMaxDiffCnt%

:: Check which type of backup (Full or Diff) needs to be created

if /i "%1"=="/f" goto :CreateFull
if %TBIFullCnt%==0 goto :CreateFull
if /i "%1"=="/d" goto :CreateDiff
if %TBIDiffCnt% LSS %TBIMaxDiffCnt% goto :CreateDiff
goto :CreateFull

:CreateDiff

echo.
echo Create Differential Image
echo -- Running command: "%TBIPath%\%ifwexe%" /b %TBIDifParms% /base:"%TBIBase%\%TBINewest%__FULL" /f:"%TBIBase%\%TBINewest%_DIFF_$~YYYY$-$~MM$-$~DD$-$~HHMM$"
start "" /wait "%TBIPath%\%ifwexe%" /b %TBIDifParms% /base:"%TBIBase%\%TBINewest%__FULL" /f:"%TBIBase%\%TBINewest%_DIFF_$~YYYY$-$~MM$-$~DD$-$~HHMM$"
goto :PostBkup

:CreateFull

if %TBIFullCnt% LSS %TBIMaxFullCnt% goto :CreateFullImage
echo.
echo Number of Full images will exceed %TBIMaxFullCnt%.
echo Deleting oldest Full image set: %TBIOldest%
set TBIOldest=%TBIOldest:~0,-10%
if %ProtectIt% EQU 0 call :CleanupNormal
if %ProtectIt% EQU 1 call :CleanupTBOSDT
if %ProtectIt% EQU 2 call :CleanupNormal
:: Check if additional old backup sets need deleted
set /a Number1=0
if exist "%TBIBase%\%TBIName%_*__FULL.tbi" for /f "delims=" %%a in ('dir "%TBIBase%\%TBIName%_*__FULL.tbi" /o-d /b /p /-p /w /-w') do (set TBIOldest=%%a) & (set /a Number1=!Number1!+1)
if %TBIFullCnt% EQU %Number1% echo. & echo Warning: Oldest Full image set not deleted. & goto :CreateFullImage
set TBIFullCnt=%Number1%
if %TBIFullCnt% LSS %TBIMaxFullCnt% goto :CreateFullImage
goto :CreateFull
:CleanupTBOSDT
echo del "%TBIBase%\%TBIOldest%*.tbi" /q > CleanupOldSet.run
echo del "%TBIBase%\%TBIOldest%*.#*" /q >> CleanupOldSet.run
echo del "%TBIBase%\%TBIOldest%*.@*" /q >> CleanupOldSet.run
"%tbosdtpath%\tbosdtw.exe" "%scriptpath%\CleanupOldSet.run"
del "%scriptpath%\CleanupOldSet.run"
goto :EOF
:CleanupNormal
if %ProtectIt% EQU 2 net stop protectit > nul 2>&1
del "%TBIBase%\%TBIOldest%*.tbi"
if exist "%TBIBase%\%TBIOldest%*.#*" del "%TBIBase%\%TBIOldest%*.#*"
if exist "%TBIBase%\%TBIOldest%*.@*" del "%TBIBase%\%TBIOldest%*.@*"
if %ProtectIt% EQU 2 net start protectit > nul 2>&1
goto :EOF

:CreateFullImage

echo.
echo Create Full Image
echo -- Running command: "%TBIPath%\%ifwexe%" %TBIParms% /f:"%TBIBase%\%TBIName%_$~YYYY$-$~MM$-$~DD$-$~HHMM$__FULL"
start "" /wait "%TBIPath%\%ifwexe%" %TBIParms% /f:"%TBIBase%\%TBIName%_$~YYYY$-$~MM$-$~DD$-$~HHMM$__FULL"
goto :PostBkup


:: ---------------------------------------------------------------------------

:PostBkup

set Error=%ERRORLEVEL%

echo.
echo #########################################
if not "%Error%"=="0" echo # The following error was reported: %Error%
if "%Error%"=="0" echo # No errors were reported.
echo #########################################
echo.

goto :End


:: ---------------------------------------------------------------------------

:NoWin

echo.
echo Windows 2000 or later is required for this script.
echo.
goto :End


:: ---------------------------------------------------------------------------

:End

set Error=
set Number1=
set Number2=
set TBIFullCnt=
set TBIDiffCnt=
set TBICmd=
set TBIOldest=
set TBINewest=

set TBIBase=
set TBIName=
set TBIParms=
set TBIPath=
set TBIMaxFullCnt=
set TBIMaxDiffCnt=
set TBIDifParms=
set TBILogin=

:: End of batch script
TeraByte Support
Posts: 3629
Joined: Thu May 05, 2011 10:37 pm

Re: Odd Differential Image Creation Times

Post by TeraByte Support »

the .log would be the place to look (and offline / boot disk to see if related to Antivirus or other software).
n8chavez
Posts: 6
Joined: Sat Dec 01, 2018 10:00 pm

Re: Odd Differential Image Creation Times

Post by n8chavez »

It's not being blocked by anything, because I'm not using an sort of scanner and behavioral antimalware. All I use is stock Windows Security, and there was no log entry indicating that it caused anything.
Post Reply