Backing Up and Restoring Files/Folders

This article describes how you can use MSP360 (CloudBerry) Backup CLI to back up and restore files/folders without saving the backup/restore configuration and creating a corresponding plan.

Back Up a File or Folder

Use the backup command to back up a file or a folder's contents to the required storage.

C:\Program Files\MSP360\MSP360 (CloudBerry) Backup>cbb backup -?

Required Parameters

The following parameters are required to execute the backup command.

  • -a or -aid Specifies the name or ID of a storage account to where to upload your backup.
  • -f and/or -d Specifies the file or directory to back up.

The following example illustrates how to back up a file and a directory to the same backup storage.

cbb backup -a "account_name_or_ID" -f "C:\file.txt" -d "C:\BackupSource"

This command will upload only files that have been changed since the last backup date.

Optional Parameters

You can use the following parameters to specify additional options for your backup.

  • -nbf Creates a backup plan in the new backup format. Learn about the new backup format in the New Backup Format chapter.

cbb addbackupibbplan -n MyFirstPlan -a MyS3STorage -nbf -f "C:\files\file.txt"

* **-s**  
Enables a [simple backup mode](/cloudberry-backup/backup/back-up-files-folders/step-5-backup-mode). This value should be set to "**yes**" or "**no**" \(the default value\).   
For example:

```bash
cbb backup -a "storage_account_name" -f "C:\backups\mybackups\db.pst" -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 backup -a "My storage account" -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 backup -a "My storage account" -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 backup -a "My storage account" -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 backup -a "My storage account" -d "C:\BackupSource" -es yes
    
  • -bef
    Indicates whether or not to include empty folders in the backup. For example:

    cbb backup -a "My storage account" -d "C:\BackupSource" -bef yes
    
  • -oa
    Indicates whether the backup should include only files that were modified after a specified date.
    For example:

    cbb backup -a "storage_account_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 backup -a "storage_account_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 backup -a "My storage account" -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 backup -a "Amazon_S3_account" -d "C:\BackupSource" -sse yes
    
  • -sia
    When using an Amazon storage account, enables an S3 Standard-Infrequent Access storage class.
    For example:

    cbb backup -a "Amazon_S3_account" -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 the backing up of files that may be locked at the time of backup. For example:

    cbb backup -a "My storage account" -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 back up 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.

  • -fastNtfs
    Enables you to speed up backup processing by using a low-level API to access NTFS structures when you need to back up a considerably large number of files that are stored on an NTFS-formatted device. For example:

    cbb backup -a "My storage account" -d "C:\BackupSource" -fastNtfs yes
    

    The resulting performance gain may vary depending on which storage device you are using and the number of files contained in your backup. While this gain may not be evident when running your backup plan for the first time, you should notice the difference when running a subsequent differential backup.

  • -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 backup -a "My storage account" -d "C:\BackupSource" -shareRw yes
    

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).

Restore a File or Folder

Use the restore command to restore a file or a folder from backup storage.

Display command help:

C:\Program Files\MSP360\MSP360 (CloudBerry) Backup>cbb restore -?

Required Parameters

The following parameters are required to execute the restore command.

  • -a. Specifies the name or ID of a storage account where your backup is located
  • -f (-file) and/or -d (-directory). Specifies the file or directory to restore

Check the following examples to learn the basics of this command usage.

Restoring the Purchasing contract.doc file from the My AWS storage account.

cbb restore -a "My AWS" -file "C:\docs\Purchasing contract.doc"

Typical errors using the restore command.

Missing quotes. Setting a path to a file or a directory requires the value to be put in quotes. For example, the following command will fail:

cbb restore -a "My AWS" -file C:\docs\Purchasing contract.doc

Always use a full path to a file to restore. The following command will fail

cbb restore -a "My Azure" -file "Appendix 3.doc"

Check the examples of the correct command usage with the same examples below.

cbb restore -a "My AWS" -file "C:\docs\Purchasing contract.doc"
cbb restore -a "My Azure" -file "d:\Ny Documents\Contracts\Appendix 3.doc"

You can use multiple arguments for this command.

cbb restore -a "My AWS" -file "C:\docs\Purchasing contract.doc" -directory "C:\docs\Purchasing contract appendices"

Optional Parameters

You can use the following parameters to specify additional options when restoring your backup.

  • -bp
    Specifies the backup prefix. Use this parameter when restoring a backup made from another computer to specify that computer's name.

Make sure that the specified backup prefix is correct. You can list backup prefixes available in specified storage by executing the "cbb prefixes" command.

  • -rl. Specifies the location to which to restore your files. Possible values: "original" (the default value) or a path to a custom location. For example:

    cbb restore -a "My storage account" -file "C:\file.txt" -location "C:\Custom"
    

    The backup service will create a directory specified as a custom location if this directory does not exist.

  • -rt (-restoreType)
    Specifies whether to restore the latest version of your file that is available in a specified backup storage at this moment or the latest version available at a specific point in time. Possible values: "latest" (the default value) or a point in time.

    MSP360 (CloudBerry) backups include only files/folders that were modified since the previous backup date. As a result, selecting this option will restore only those file versions that were modified before the most recent backup and are not yet available in the destination folder.

    For example, the following command restores the latest version of a file that is available in the backup storage at a specified point in time.

    cbb restore -a "My storage account" -file "C:\file.txt" -restoreType "4/27/2018 3:00:00 PM"
    
  • -o (-overwrite)
    Indicates whether to overwrite all files in the destination folder for the restored backup, or restore only files that were never restored before. For example:

    cbb restore -a "My storage account" -directory "C:\Temp" -overwrite
    
  • -rn (-restoreNew) Specifies whether to restore only newer file versions or all files regardless of when they were modified.

  • -ep (-encryptionPassword) Specifies the password to restore encrypted files/folders. These files will not be restored unless you have specified a valid encryption password.

  • -ntfs Indicates whether or not to restore NTFS permissions assigned to files stored in your backup.

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).

Delete Files/Folders from a Backup Storage {#section-delete-files}

To delete objects on backup storage, use the delete command.

C:\Program Files\MSP360\MSP360 (CloudBerry) Backup>cbb delete -?

Required Parameters

The following parameters are required to execute the delete command.

  • -a. Specifies the name of a storage account from where you would like to delete files or folders
  • -f (-file) and/or -d (-directory). Specifies the file or directory to delete

The following parameter defines the standard output format for this command.

  • -output Specifies the output format: "short" or "full" (the default value).

Example

The following command deletes all versions of the specified file and folder from backup storage.

cbb delete -a "My storage account" -file "C:\file.txt" -directory "C:\Backup"
https://git.cloudberrylab.com/egor.m/doc-help-std.git