Command Line Manual : cbackup


The cbackup command is the main command for CubeBackup. This command can be used to check the version number, migrate backup data to another location, reset the administrator of the CubeBackup console, etc.

The cbackup command must be run on the backup server.
The cbackup file is located in the <cubebackup installation directory>/bin folder.

On Windows, cbackup.exe is located in C:\Program Files\CubeBackup4\bin by default.
On Linux, cbackup is located in /opt/cubebackup/bin by default.

SYNOPSIS

cbackup <command> [option]

COMMANDS

The following commands can be used by cbackup.

archive: Archive a user’s data to a specified storage
filesExclude: Filter drive files included in the backup
migration: Migrate backup data to a new location
removeDomain: Remove a domain from CubeBackup
setDomainAdminEmail: Change domain admin email to reflect a change of administrator made in the G Suite domain.
syncDataIndex: Manually merge the data index to the backup data.
version: Display CubeBackup version.

NOTE:

[Important!] The migration, removeDomain, setConsoleAdminEmail, setDomainAdminEmail, syncDataIndex commands all require Administrator/root privilege.

If CubeBackup runs on a Windows machine, please run these commands as an administrator.
If CubeBackup runs on a Linux server, please use “sudo cbackup <command>” in a bash shell.

cbackup archive

The cbackup archive command allows you to archive a user’s data to a location of your choice. This is especially useful when an employee has left your organization and you would like to keep an archive of his data for possible future use.

SYNOPSIS

cbackup archive <domain name> <user email or shared drive id> <app> <destination path>
  • domain name: the name of your domain (e.g. mycompany.com)
  • user email/shared drive id: the user account you wish to archive (e.g. someone@mycompany.com), or a shared drive ID (e.g. AAGFI5-SlBKnUk9PV)
  • app: must be one of these values: all, gmail, drive, calendar, contacts, sites. Choose all to archive all G Suite data for this user.
  • destination path: The output directory. This can be a local directory or a location on your network.

TIP: If you want to compress the archive data to a ZIP file, you can also specify the name of the ZIP file as the destination path. For example:

cbackup archive mycompany.com  someone@mycompany.com all  /var/archive/cube.zip

will archive all data of user someone@mycompany.com into the cube.zip file instead of exporting all files into a directory.

NOTE: This command requires special privilege.
On Windows, it must be run by an Administrator account.
On Linux, it must be run by the cbuser account.

If CubeBackup runs on Windows, please run this command as an administrator.
If CubeBackup runs on Linux, please use “sudo -u cbuser …” in a bash shell.

EXAMPLES

Suppose you want to archive all G Suite data for user abc@companydomain.com to a directory named archive_data. (The directory can be located on a local disk or on your network.)

  1. Login to the backup server.
  2. Open a Windows Powershell or Windows Command Prompt using an Administrator account.
  3. In the <cubebackup installation folder>/bin directory, run the command:

    cbackup archive companydomain.com  abc@companydomain.com all f:\archive_data
  1. SSH into the backup server.
  2. Make sure cbuser has write permission to the target directory. One way to do this is to change the owner of the target directory to cbuser.

    sudo chown cbuser:cbuser  /mnt/archive_data
  3. In a bash shell, run the command:

    sudo -u cbuser cbackup archive companydomain.com  abc@companydomain.com all  /mnt/archive_data/abc

cbackup filesExclude

Some organizations may not wish to back up large or unimportant files in Google Drive or Shared drives in order to save backup storage space.

To filter out these files from the backup storage, you can set file exclusion rules on the SETTINGS > Apps > Options dialog. For detailed information about how to set file exclusion rules, please refer to Exclude files that match any of the following rules.

To protect the safety of your backup set, CubeBackup will not automatically use these rules to purge files which have previously been backed up. You must run the cbackup filesExclude remove command to manually purge those unwanted files from the backup data. For more information on how to remove unnecessary files from backup storage, see this tutorial.

This command has two subcommands: cbackup filesExclude list and cbackup filesExclude remove.

cbackup filesExclude list

This command will list backup files which match the File exclusion rules. This is useful to check which currently backed up files will be excluded from future backups using the rules set in the CubeBackup web console. It is strongly recommended that you run this command before the cbackup filesExclude remove command to double-check which files will be deleted from your backup.

SYNOPSIS

cbackup filesExclude list <domain name>

NOTE: This command requires special privileges.

  • On Windows, it must be run by an Administrator account.
  • On Linux, it must be run by the cbuser account. For example:

    sudo -u cbuser /opt/cubebackup/bin/cbackup filesExclude list mydomain.com

cbackup filesExclude remove

This command removes files matching the rules set in the CubeBackup web console from your backup set.

SYNOPSIS

cbackup filesExclude remove <domain name>

Note:

  1. Before purging unwanted files from the backup storage, please run the cbackup filesExclude list command to check which files will be removed.

  2. Before running this command, you should first stop the CubeBackup service.
    On Linux:

    sudo  /opt/cubebackup/bin/cbsrv stop

    On Windows: Enter services.msc in the command line, and then in the Services list that pops up, right click the CubeBackup Service entry and select Stop.

  3. This command requires special privileges.
    On Windows, it must be run by an Administrator account.
    On Linux, it must be run by the cbuser account. For example:

    sudo -u cbuser /opt/cubebackup/bin/cbackup filesExclude remove mydomain.com

cbackup purgeUser

The cbackup purgeUser command allows you to remove the backup data of a specific user. This can be helpful when you need to purge an unwanted user who has left your organization. For detailed information on purging a user, please refer to How to remove backups for a specific user or shared drive.

SYNOPSIS

cbackup purgeUser <user email>

Note:

  1. Before running this command, you should first stop the CubeBackup service.
    On Linux:

    sudo  /opt/cubebackup/bin/cbsrv stop

    On Windows: Enter services.msc in the command line, and then in the Services list that pops up, right click the CubeBackup Service entry and select Stop.

  2. This command requires special privileges.
    On Windows, it must be run by an Administrator account.
    On Linux, it must be run by the cbuser account.

    sudo -u cbuser /opt/cubebackup/bin/cbackup purgeUser <user email>

cbackup purgeSharedDrive

The cbackup purgeSharedDrive command allows you to remove the backup data of a specific shared drive. This can be helpful when you need to free up space by removing a shared drive that is no longer needed. For detailed information on purging a shared drive, please refer to How to remove backups for a specific user or shared drive.

SYNOPSIS

cbackup purgeSharedDrive <shared drive id>

Note:

  1. Before running this command, you should first stop the CubeBackup service.
    On Linux:

    sudo  /opt/cubebackup/bin/cbsrv stop

    On Windows: Enter services.msc in the command line, and then in the Services list that pops up, right click the CubeBackup Service entry and select Stop.

  2. This command requires special privileges.
    On Windows, it must be run by an Administrator account.
    On Linux, it must be run by the cbuser account.

    sudo -u cbuser /opt/cubebackup/bin/cbackup purgeSharedDrive <shared drive id>
  3. You can find the ID of the shared drive in the URL of the shared drive’s Restore page.

cbackup migration

The cbackup migration command allows you to migrate your current backup data to a new location. This can be useful if your current storage is full or if you wish to change to a different storage type. For example, you can move your backups from a local disk to AWS S3 storage, or from AWS S3 to a NAS inside your organization.

SYNOPSIS

  • To migrate current backup data to a new local directory:

    cbackup migration [-dataIndexPath=<new Index Path>] local <local destination path>
  • To migrate current backup data to mounted network storage (Linux)

    cbackup migration [-dataIndexPath=<new Index Path>] nas <mounted network storage path>
  • To migrate current backup data to network storage (Windows)

    cbackup migration [-dataIndexPath=<new Index Path>] wins <windows network destination path> <username> [password]
  • To migrate current backup data to an Amazon S3 bucket:

    cbackup migration [-dataIndexPath=<new Index Path>] s3 <s3 destination bucket> <access key id> <secret key id> [storage class] 
  • To migrate current backup data to a Google Cloud Storage bucket:

    cbackup migration [-dataIndexPath=<new Index Path>] google <google destination bucket> [storage class] 
  • To migrate current backup data to an Azure Blob Storage Container:

    cbackup migration [-dataIndexPath=<new Index Path>] azure <storage account> <access key> <container> [access tier] 
  • To migrate current backup data to S3-compatible storage ( Wasabi / BackBlaze B2 ):

    cbackup migration [-dataIndex=<new Index Path>] s3c <endpoint> <bucket> <access key id> <secret access key>

OPTIONS:

  • -dataIndexPath: Specify a new local directory for the data index path.
    If this option is not specified, CubeBackup will not migrate the data index, but keep it where it is. In most cases, there is no need to specify a new path for the data index.


For detailed instructions and examples on how to use cbackup migration, please refer to How to migrate Google Workspace backup data to a new location?

cbackup removeDomain

Many G Suite administrators and G Suite partners back up multiple G Suite domains using CubeBackup. The cbackup removeDomain command can be used to remove a G Suite domain from the backup list.

SYNOPSIS

cbackup removeDomain <domain name>

NOTE:

  • The cbackup removeDomain command removes only the domain (not the backup data) from CubeBackup. That is, CubeBackup will no longer back up the specified domain, but the backup data for this domain remains completely untouched.
  • If a restore request comes up for this domain after it has been removed, you can add this G Suite domain again and the backups for this domain will once again show up in the RESTORE page.
  • Please do NOT use this command if you only have one G Suite domain in CubeBackup. Removing the sole domain will crash CubeBackup.
  • This command requires Administrator/root privilege.

    If CubeBackup runs on Windows, please run this command as an administrator.
    If CubeBackup runs on Linux, please use “*sudo …*” in the bash shell.

For detailed instructions on how to use this command, please refer to How to remove a G Suite domain from CubeBackup?

cbackup setDomainAdminEmail

CubeBackup relies on the correct G Suite domain administrator account for domain-wide OAuth authentication. If the administrator of your G Suite domain has been changed, all Google API requests will fail and CubeBackup will no longer work until it has been updated with the new G Suite domain administrator information.

SYNOPSIS

cbackup setDomainAdminEmail <domain name> <new admin email>

NOTE:

  • This command requires Administrator/root privilege.

    If CubeBackup runs on Linux, please use “sudo …” in the bash shell.
    If CubeBackup runs on Windows, please run this command as an administrator.

  • After updating CubeBackup with the new G Suite domain administrator email, you need to restart the CubeBackup service in order for the changes to take effect.

    If CubeBackup is installed on Linux, run this command in the bash shell:

    sudo /opt/cubebackup/bin/cbsrv restart

    If CubeBackup is installed on Windows, enter services.msc in the command line, then in the Services list that pops up, right-click the CubeBackup entry, and select Restart.

EXAMPLES

Suppose your G Suite domain administrator has been replaced and the new administrator’s email is abc@companydomain.com. All Google API requests will fail until CubeBackup is updated with the new administrator’s information using the command cbackup setDomainAdminEmail.

  1. Login to the backup server.
  2. Open a Windows Powershell or Windows Command Prompt using an Administrator account.
  3. In the <cubebackup installation folder>/bin directory, run the command:

    cbackup setDomainAdminEmail  companydomain.com  abc@companydomain.com
  4. Restart the CubeBackup service
    Enter services.msc in the command line, then in the Services list that pops-up, right-click the CubeBackup entry, and select Restart.

  1. SSH into the backup server.
  2. In a bash shell, run the command:

    sudo /opt/cubebackup/bin/cbackup setDomainAdminEmail companydomain.com  abc@companydomain.com
  3. Restart the CubeBackup service

    sudo /opt/cubebackup/bin/cbsrv restart

cbackup syncDataIndex

The cbackup syncDataIndex command manually merges all index data to the backup data. This command is only used under special circumstances.

SYNOPSIS

cbackup syncDataIndex

NOTE: This command requires special privilege.
On Windows, it must be run by the Administrator account.
On Linux, it must be run by the cbuser account.

For an example of using this command, please visit How to move the data index to another location?

cbackup version

This command will display the current version of CubeBackup.

SYNOPSIS

cbackup version