How to remove large unnecessary files from backup storage in order to save space.


When you back up Google Workspace data using CubeBackup, the size of the backup can easily balloon, especially for large organizations. For example, one employee might upload many large unimportant videos to his Google Drive, or another may keep different copies of his VM images or Mac Time machine backups in Google Drive. These files can consume a large amount of space in your backup storage.

CubeBackup allows you to filter out these large unnecessary files from your backups based on your own customized rules. Using CubeBackup, you can set file exclusion rules before the first backup starts to prevent certain files from ever being backed up. You can also use these exclusion rules to remove unnecessary files from the backup storage at a later date.

Prevent files from being backed up before the start of the first backup

After installing CubeBackup on your server and setting it up, you can log into the CubeBackup web console and add your file exclusion rules before the first backup starts.

  1. In the CubeBackup console, select SETTINGS, and then in the Apps section click *Options at the right of the Drive switch.

  2. In the filter dialog that pops up, you can add multiple file exclusion rules. For a detailed explanation and examples of the exclusion rules, please refer to File Exclusion Rules.

NOTE:

  1. Once a backup has been started, changes to the exclusion rules will only take effect after the current backup has completed. That is, they will apply to all subsequent backups, but not to the currently running backup.
  2. If you are unsure whether certain files need to be excluded in the backup, or you are concerned that important files may be mistakenly excluded, it is safer to leave the exclusion rules empty. You can still remove unwanted files after the initial backup is completed.

Remove unimportant files from the backup data

It is not absolutely necessary to set up the file exclusion rules before the first backup. In most cases, administrators may find unnecessary files after backups have already been performed. Don't worry, CubeBackup can still remove these files based on your exclusion rules to free up disk space or cloud storage.

CubeBackup allows you to easily purge files from the backup data using the cbackup filesExclude command. Please follow the detailed instructions appropriate for your operating system.

  1. Log into the CubeBackup console, add the exclusion rules in the SETTINGS > Apps > *Options dialog, then click the "Update settings" button. For detailed information on how to write the file exclusion rules, see File exclusion explanation and examples.

  2. Log into the backup server.

  3. Be sure to stop the CubeBackup service before running this command:
    Open a Command Prompt or Windows Powershell as Administrator and run the following command:

    "C:\Program Files\CubeBackup4\bin\cbsrv.exe" stop # in Command Prompt 
    
    & "C:\Program Files\CubeBackup4\bin\cbsrv.exe" stop # in Windows Powershell 
    

  4. Run the cbackup filesExclude list command to list all files that match your exclusion rules.

    "C:\Program Files\CubeBackup4\bin\cbackup.exe" filesExclude list <domain_name>

    Note:
    (1) This command requires special privileges. Please run this command as Administrator.
    (2) Depending on the size of the domain's data, this process may take quite a while.

  5. Run the cbackup filesExclude remove command to purge files from the backup data. When prompted, double-check that this is the correct user to be deleted. Type "yes" to purge all matched data for that specific domain.

    "C:\Program Files\CubeBackup4\bin\cbackup.exe" filesExclude remove <domain_name>
  6. After running this command, you will need to start the CubeBackup service:
    Open a Command Prompt or Windows Powershell as Administrator and run the following command:

    "C:\Program Files\CubeBackup4\bin\cbsrv.exe" start # in Command Prompt 
    
    & "C:\Program Files\CubeBackup4\bin\cbsrv.exe" start # in Windows Powershell 
    

  7. In the CubeBackup console, you will now see that the storage status information on the OVERVIEW page has updated.

  1. Log into the CubeBackup console, add the exclusion rules in the SETTINGS > Apps > *Options dialog, then click the "Update settings" button. For detailed information on how to write the file exclusion rules, see File exclusion explanation and examples.

  2. SSH into the backup server.

  3. Before running this command, be sure to stop the CubeBackup service:

    sudo /opt/cubebackup/bin/cbsrv stop
  4. Run the cbackup filesExclude list command to list all files that match your exclusion rules.

    sudo -u cbuser /opt/cubebackup/cbackup filesExclude list <domain_name> 

    Note:
    (1) This command requires special privileges and must be run by the cbuser account.
    (2) Depending on the size of the domain's data, this process may take quite a while.

  5. Run the cbackup filesExclude remove command to purge files from the backup data. When prompted, double-check that this is the correct user to be deleted. Type "yes" to purge all matched data for that specific domain.

    sudo -u cbuser /opt/cubebackup/cbackup filesExclude remove <domain_name> 
  6. After running this command, you will need to start the CubeBackup service.

    sudo /opt/cubebackup/bin/cbsrv start
  7. In the CubeBackup console, you will now see that the storage status information on the OVERVIEW page has updated.

  1. Log into the CubeBackup console, add the exclusion rules in the SETTINGS > Apps > *Options dialog, then click the "Update settings" button. For detailed information on how to write the file exclusion rules, see File exclusion explanation and examples.

  2. Find the container id for CubeBackup:

    docker ps -a
  3. Switch to maintenance mode by running the following command:

    docker exec <container_name_or_id> touch /cubebackup_maintenance && docker restart <container_name_or_id>
  4. Open the bash shell of the container:

    docker exec -it <container_name_or_id> bash
  5. Run the cbackup filesExclude list command to list all files that match your exclusion rules.

    sudo -u cbuser /opt/cubebackup/cbackup filesExclude list <domain_name> 

    Note:
    (1) This command requires special privileges and must be run by the cbuser account.
    (2) Depending on the size of the domain's data, this process may take quite a while.

  6. Run the cbackup filesExclude remove command to purge files from the backup data. When prompted, type "yes" to confirm and purge all matched data for that specific domain.

    sudo -u cbuser /opt/cubebackup/cbackup filesExclude remove <domain_name> 
  7. After the cbackup filesExclude command has successfully completed, type exit to exit the container and run the following command to quit maintenance mode:

    docker exec <container_name_or_id> rm /cubebackup_maintenance && docker restart <container_name_or_id>
  8. In the CubeBackup console, you will now see that the storage status information on the OVERVIEW page has updated.