File Backup
This chapter contains CLI command description for file backup plans in CloudBerry Backup.
Create Backup Plan
To create a new plan, use the addBackupPlan command.
To read a command help, execute the following command:
cbb addBackupPlan -?
Required Parameters
The following parameters are required to execute the addBackupPlan command.
- -n. Specifies the backup plan name. Although backup plans can have identical names, better assign a unique name to each plan to avoid ambiguities when executing plans using CLI
- -f and/or -d. Specifies the file and/or directory to back up
- -a or -aid. Specifies the name or ID of a storage account used in the backup plan.
The following examples create a new backup plan named 'Plan_name' that uploads a file and a directory to a backup storage named 'MyStorage'.
New backup format:
cbb addBackupPlan -nbf -a "MyStorage" -n "Plan_name" -d "C:\BackupSource" -f "C:\file.txt"
Legacy backup format:
cbb addBackupPlan -a "MyStorage" -n "Plan_name" -d "C:\BackupSource" -f "C:\file.txt"
To create a plan from the existing one, execute the addBackupPlan command with a "-clonePlan" parameter.
Example:
cbb addBackupPlan -clonePlan "existing_plan_name" -n "new_plan_name"
See the Parameters section to learn about all parameters available for editing a backup plan using the addBackupPlan command.
Edit a Backup Plan
Use the editBackupPlan command to customize an existing backup plan.
C:\Program Files\MSP360\MSP360 (CloudBerry)>cbb editBackupPlan -?
The following example illustrates how to rename a backup plan.
cbb editBackupPlan -n "old_name" -nn "new_name"
The following example illustrates how to add a new file and folder to existing backup plan.
cbb editBackupPlan -n "plan_name" -af "C:\file.txt" -ad "C:\Temp"
The following example illustrates how to remove a file and folder from an existing backup plan.
cbb editBackupPlan -n "plan_name" -rf "C:\file.txt" -rd "C:\Temp"
The following example illustrates how to disable encryption for a backup plan.
cbb editBackupPlan -n "plan_name" -ed
The following example illustrates how to disable a general schedule defined for a backup plan.
cbb editBackupPlan -n "plan_name" -sd
The following example illustrates how to disable a full backup schedule.
cbb editBackupPlan -n "plan_name" -sdForce
See the Parameters section to learn about all parameters available for editing a backup plan using the editBackupPlan command.
Parameters
Optional Parameters
You can use the following parameters to configure/edit your backup plan.
-useBlockLevelBackup
Set this parameter to "yes" to enable a block-level backup.
When this option is enabled, you can schedule a full backup as well. See the Scheduling Full Backup section further in this article for more information.
-s
Enables a simple backup mode. This value should be set to "yes" or "no" (the default value).
For example:cbb addBackupPlan -a "account" -n "plan_name" -f "C:\file.txt" -s yes
-custom
Enables a custom backup mode. When using this parameter, you need to specify a path to a custom folder in your backup storage. For example:cbb addBackupPlan -a "account" -n "plan_name" -f "C:\file.txt" -custom "C:\CustomFolder"
-ifm or -efm
Specifies a mask, indicating the files to include in the backup or exclude from it. For example:cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -ifm "*.exe; *.txt"
You can list multiple masks separated by a semicolon.
-skipf
Specifies which folders to skip during backup processing. For example:cbb addBackupPlan -a "account" -n "plan_name" -d "C:\Temp" -skipf "C:\Temp\Folder_1; C:\Temp\Folder_2"
You can list multiple folders separated by a semicolon.
-es
Indicates whether or not to include system and hidden files in the backup. For example:cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -es yes
-bef
Indicates whether or not to include empty folders in the backup. For example:cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -bef yes
-oa
Indicates whether the backup should include only files that were modified after a specified date.
For example:cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -oa "4/27/2018 3:12 PM"
-c
Indicates whether or not to compress files in the backup. For example:cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -c yes
This can speed up uploading of your backup while it takes longer to process it before uploading.
-ea and -ep
Encrypts the backup's contents using a specified algorithm (AES128, AES192 or AES256) and protects the backup with a password. For example:cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -ea "AES192" -ep "password"
When updating an existing file-level backup that was not previously encrypted, the encryption will only apply to the newly uploaded files.
-sse
Enables server-side encryption of the backup's contents (if a storage provider supports this feature).
For example:cbb addBackupPlan -a "Amazon_S3_account" -n "plan_name" -d "C:\BackupSource" -sse yes
-sia
When using an Amazon storage account, enables an S3 Standard-Infrequent Access storage class.
For example:cbb addBackupPlan -a "Amazon_S3_account" -n "plan_name" -d "C:\BackupSource" -sia yes
-vss
Forces Volume Shadow Copy Service (VSS) that captures and copies stable images for backup on running systems without degrading the performance and stability of the services they provide. Use this option to force backing up of files that may be locked at the time of backup. For example:cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -vss yes
When this option is disabled, a backup service starts creating a shadow copy only after coming across a locked file. When this option is enabled, the backup service creates a shadow copy beforehand and does not attempt to backup locked files.
When using this feature, you can manually specify a custom VSS provider of your choice (see below).
Please consider the following limitations that apply to using this service:
- VSS cannot be used to back up network files, such as network shares and mapped network drives.
- VSS cannot make snapshots of data stored in FAT32-partitioned volumes.
-shareRw
Enables using a shared read/write mode to overcome errors when attempting to back up files that are currently opened in other applications. For example:
cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -shareRw yes
-ntfs
Enables you to back up NTFS permissions assigned to files and/or folders. For example:cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -ntfs yes
-iepnf
Prevents the backup service from displaying the "path not found" errors when it cannot locate a specified folder. For example:cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -iepnf yes
This option is only supported when backing up a directory (by specifying the "-d" parameter). Specifying the "-iepnf" parameter when backing up a file (using the "-f" parameter) results in an error.
-sp
Indicates whether or not to save the backup plan configuration to the backup storage along with the backup's contents. For example:cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -sp yes
Executing Custom Scripts
Use the following parameters to execute custom scripts before and/or after running a backup plan.
- -preAction Specifies a command to execute before launching the backup
- -pac Indicates whether or not the backup service should continue backup processing if the pre-backup action failed
- -postAction Specifies a command to execute after completing the backup
- -paa Indicates whether or not the backup service should execute the post-backup action regardless of the backup processing result
The following command creates a plan and specifies custom scripts to be executed before and after running this plan.
cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -preAction "C:\_Temp\script.cmd /F:ON /C" -pac yes -postAction "PowerShell.exe Start-Process cmd.exe exit" -paa no
See Adding Pre/Post Actions to learn more about using this feature.
Customizing Email Notification Settings
Use the following parameters to specify how the backup service should deliver email notifications after executing your backup plan and maintain the service log.
Before specifying these options, you need to configure the global notification and logging settings of the backup service. See Managing Email Notifications to learn more.
- -notification Specifies whether to send email notifications only when a backup fails ("errorOnly") or in all cases ("on").
- -dr Indicates whether the backup service should generate a detailed or simple report.
- -winLog Indicates whether to add an entry to Windows Event Log only when the backup fails ("errorOnly") or in all cases ("on").
The following example illustrates how you can use these parameters.
cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -notification "errorOnly" -dr yes -winLog "on"
Customizing Retention Settings
Use the following options to configure the retention settings of your backup plan.
- -df Enables you to purge locally deleted files from a backup storage after a specified number of days.
- -purge Makes a backup service delete file versions that were modified or uploaded to your backup storage more than a certain number of days ago. The following values are supported:
- "no" - indicates that data is stored for indefinite period.
- "d (day)" - specifies for how many days to store your data.
- "w (week)" - specifies for how many weeks to store your data.
- "m (month)" - specifies for how many months to store your data.
- -delayPurge Specifies the maximum number of versions that a backup service should keep in the storage for each file. The following values are supported:
- "no" - enables immediate removal of files after they have been deleted in a source storage.
- "d (day)" - specifies for how many days to keep locally deleted files in the backup storage.
- "w (week)" - specifies for how many weeks to keep locally deleted files in the backup storage.
- "m (month)" - specifies for how many months to keep locally deleted files in the backup storage.
- -keep Specifies the maximum number of versions that a backup service should keep in the storage for each file.
- -keepLastVersion Indicates whether to keep the last version of each file in a backup storage at all times, regardless of any other retention settings.
The following example illustrates how you can specify these parameters.
cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -df 30 -purge 1week -delayPurge 1week -keep 5 -keepLastVersion yes
If you enabled ransomware protection (the "-useRansomwareProtection" parameter is set to "yes"), a backup service will ignore the current retention policy settings on detecting ransomware activity. In this case, the backup service will keep the latest undamaged version of your files regardless of what retention policy is defined for your application or for the current backup plan.
See Managing Application Settings to learn how to configure the global retention policy settings of a backup service.
Customizing Scheduling Settings
Use the following parameters to enable your backup plan to run automatically on schedule.
-at
Specifies the time at which the backup plan should run. When other scheduling parameters are not defined, specifying only the time indicates that the backup plan should run at this time on the day of this plan's creation.
This parameter is required if you need to run your backup plan on a recurrent basis and specify corresponding scheduling options described below.
Instead of using the "-at" parameter, you can use the "-occurs" parameter (see below) to run the backup plan once in a specified number of hours or days.You can specify both the date and time if you do not need to run your backup plan on a recurring basis, for example:
cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -at "5/28/2018 6:00 PM"
-every Enables you to run the backup plan on a recurring basis. The following values are supported:
"day"
Enables running the backup plan every day. For example:cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -at "6:00 PM" -every day
"week"
Enables running the backup plan every week. Use the "-weekday" parameter to specify one or more weekdays. For example:cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -at "6:00 PM" -every week -weekday "su, mo"
"month"
Enables running the backup plan on a monthly basis. When no additional parameters are specified, the backup plan will run every month on the first Sunday by default. You can use the "-weekNumber" and "-weekday" parameters to specify a custom monthly schedule. For example, the following plan will be executed on a third Monday of every month.cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -at "6:00 PM" -every month -weekNumber "third" -weekday "mo"
- The following values are supported for the "-weekNumber" parameter: "first", "second", "third", "fourth", "penultimate", "last".
- The following values are supported for the "-weekday" parameter: "su", "mo", "tu", "we", "th", "fr", "sa".
"dayOfMonth" Not supported.
"real-time"
Enables the backup service to monitor the source files in the background and update the backup in a storage in real time when any changes have been made to the source files. For example:cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -at "6:00 PM" -every real-time
-occurs
When the "-every" parameter is set to "day" (see above), indicating that the backup plan should run on a daily basis, you can make the backup plan run once in a certain number of hours or days within a specified time period by using the "-occurs" parameter instead of "-at".If the "-every" parameter is set to "day", specifying both the "-occurs" and "-at" parameters at once will result in an error.
The following values are supported for the "-occurs" parameter:
- "day" - enables running the backup plan once in a specified number of days.
- "hour" - enables running the backup plan once in a specified number of hours.
After specifying this parameter, use the "-occurValue" parameter to specify how many hours or days should pass before each run.
In addition, you can use the "-dailyFrom" and "-dailyTill" parameters to specify the time range within which the recurrence should take effect. These parameters accept a time-span value in the following format: "dd.hh:mm:ss".
The following example illustrates how to make a backup plan run every two hours between 6:00 AM and 6:00 PM every day.
cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -every day -occurs hour -occurValue 2 -dailyFrom "00.06:00:00" -dailyTill "00.18:00:00"
-runMissed Set this parameter to "yes" to make the backup plan run automatically when computer starts up if a scheduled run was missed for any reason.
Scheduling a Full Backup
When the "-useBlockLevelBackup" parameter is set to "yes" (see above), indicating that block-level backup is enabled, we recommend that you force a full backup on schedule by using the parameters described below. The full backup's schedule is independent from general scheduling options defined for a backup plan.
-atForce
Similar to the "-at" parameter of a general schedule, this parameter specifies the time at which a full backup should run. When other scheduling parameters are not defined, specifying only the time indicates that a full backup should run at this time on the day of this plan's creation.This parameter is required if you need to run a full backup on a recurrent basis and specify corresponding scheduling options described below.
Instead of using the "-atForce" parameter, you can use the "-occursForce" parameter (see below) to run a full backup once in a specified number of hours or days.
You can specify both the date and time if you do not need to run a full backup plan on a recurring basis, for example:
cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -useBlockLevelBackup yes -atForce "4/28/2018 6:00 PM"
-everyForce Enables you to run a full backup on a recurring basis. The following values are supported:
"day"
Enables running a full backup every day. For example:cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -useBlockLevelBackup yes -atForce "6:00 PM" -everyForce day
"week"
Enables running a full backup every week on a specified weekday. Use the "-weekdayForce" parameter to specify one or more weekdays. For example:cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -useBlockLevelBackup yes -atForce "6:00 PM" -everyForce week -weekdayForce "su, mo"
"month"
Enables running a full backup on a monthly basis. When no additional parameters are specified, the full backup will run every month on the first Sunday by default. You can use the "-weekNumberForce" and "-weekdayForce" parameters to specify a custom monthly schedule. For example, the following full backup will run on every third Monday of every month .cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -useBlockLevelBackup yes -atForce "6:00 PM" -everyForce month -weekNumberForce "third" -weekdayForce "mo"
- The following values are supported for the "-weekNumberForce" parameter: "first", "second", "third", "fourth", "penultimate", "last".
- The following values are supported for the "-weekdayForce" parameter: "su", "mo", "tu", "we", "th", "fr", "sa".
"dayOfMonth" Not supported.
"real-time"
Enables the backup service to monitor the source files in the background and perform a full backup in real time when any changes have been made to the source files. For example:cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -useBlockLevelBackup yes -atForce "6:00 PM" -everyForce real-time
-occursForce
When the "-everyForce" parameter is set to "day" (see above), indicating that a full backup should run on a daily basis, you can make the full backup run once in a certain number of hours or days within a specified time period by using the "-occursForce" parameter instead of "-atForce".If the "-everyForce" parameter is set to "day", specifying both the "-occursForce" and "-atForce" parameters at once will result in an error.
The following values are supported for the "-occursForce" parameter:
- "day" - enables running a full backup once in a specified number of days.
- "hour" - enables running a full backup once in a specified number of hours.
After specifying this parameter, use the "-occurValueForce" parameter to specify how many hours or days should pass before each run.
In addition, you can use the "-dailyFromForce" and "-dailyTillForce" parameters to specify the time range within which the recurrence should take effect. These parameters accept a time-span value in the following format: "dd.hh:mm:ss".
The following example illustrates how to make a full backup run every two hours between 6:00 AM and 6:00 PM every day.
cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -useBlockLevelBackup yes -everyForce day -occursForce hour -occurValueForce 2 -dailyFromForce "00.06:00:00" -dailyTillForce "00.18:00:00"
Additional Options
Use the "-tag" parameter to specify custom additional information for your backup plan. For example:
cbb addBackupPlan -a "account" -n "plan_name" -d "C:\BackupSource" -tag "Custom info"
The following parameters define the standard output format for this command.
- -json Send the status to stdout in a JSON format.
- -xml Send the status to stdout in an XML format.
- -output Specifies the output format: "short" or "full" (the default value).