How to remove backups for a specific user or shared drive.


In some situations, you may wish to remove the backup data for a specific user or shared drive. Perhaps a user has left your organization, or you simply wish to free up space by removing a shared drive that is no longer needed.

Remove a specific user

CubeBackup allows you to easily purge specific users from your backup set. Please follow the detailed instructions appropriate for your operating system.

  1. Log into the backup server.

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

  3. Open a Windows Command Prompt or Powershell using an Administrator account. Run the cbackup purgeUser command in the <installation directory>\bin folder, and when prompted, double-check that this is the correct user to be deleted. Type "yes" to purge all backup data for that specific user.

    "C:\Program Files\CubeBackup4\bin\cbackup.exe" purgeUser <user_email>

    Note:
    (1) If the user has already been deleted in Google Workspace, you can choose to also remove him or her from the user list in CubeBackup. This will completely delete the user so it will no longer appear in the CubeBackup web console.
    (2) To remove multiple users at the same time, you can create a batch file that includes the following command for each user to be removed:

    echo yes | "C:\Program Files\CubeBackup4\bin\cbackup.exe" purgeUser <user_email>
  4. 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 
    

  5. Now you can log into the CubeBackup console and see that:

    • No files/messages are listed under the user's account on the RESTORE page.
    • The statistical data on the OVERVIEW page has been refreshed to reflect the changes.
    • The purged user has now been deselected from the SETTINGS > Users list and will not be included in future backups.
  1. SSH into the backup server.

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

    sudo /opt/cubebackup/bin/cbsrv stop
  3. Run the cbackup purgeUser command, recheck the user name, and type "yes" to purge all backup data for the specific user.

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

    Note:
    (1) This command requires special privileges and must be run by the cbuser account.
    (2) If the user has already been deleted in Google Workspace, you can choose to also remove it from the user list in CubeBackup. This will completely delete the user so it will no longer appear in the CubeBackup web console.
    (3) To remove multiple users at the same time, you can create a bash script that includes the following command for each user to be removed:

    yes | sudo -u cbuser /opt/cubebackup/bin/cbackup purgeUser <user_email>
  4. After running this command, you will need to start the CubeBackup service.

    sudo /opt/cubebackup/bin/cbsrv start
  5. Now you can log into the CubeBackup console and see that:

    • No files/messages are listed under the user's account on the RESTORE page.
    • The statistical data on the OVERVIEW page has been refreshed to reflect the changes.
    • The purged user has now been deselected from the SETTINGS > Users list and will not be included in future backups.

The cbackup purgeUser command will remove the backup data of a specific user. However, this command can only work after the CubeBackup service has stopped. This means that you need to stop the docker container before running the command, but that, in turn, makes running the cbackup purgeUser command a bit tricky. Please carefully follow the instructions below to purge the backup data for a specific user from the storage.

  1. Find the container id for CubeBackup:

    docker ps -a
  2. Stop the CubeBackup container:

    docker stop <container_id>
  3. Commit the stopped container into a new image (for example, cube/tmp_img):

    docker commit <container_id> cube/tmp_img

    This command saves the modified container state into a new image.

  4. Start a new docker based on the new temporary image with a bash command.

    Please note that you need to mount the volumes exactly as they were in the original CubeBackup docker container so that the new container can properly access the backup data. For example:

    docker run -ti   \
    -v /var/cubebackup_index:/cubebackup_index \
    -v /var/cubebackup_data:/cubebackup_data \
    --mount source=cube_cfg,target=/opt/cubebackup/etc \
    --mount source=cube_db,target=/opt/cubebackup/db \
    --mount source=cube_log,target=/opt/cubebackup/log \
    cube/tmp_img \
    /bin/bash
  5. Now in the bash shell of the new docker, install the sudo command:

    yum install sudo -y
  6. Run the cbackup purgeUser command in the docker container.

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

    When prompted, type "yes" to confirm, and CubeBackup will delete the backup data for the specified user. Depending on the size of the user's data, this process may take quite a while.

    Note: If the user has already been deleted in Google Workspace, you can choose to also remove it from the user list in CubeBackup. This will completely delete the user so it will no longer appear in the CubeBackup web console.

  7. After the cbackup purgeUser command has successfully completed, type exit to stop and exit the temporary container.

  8. Restart the original CubeBackup container.

    docker start <container_id>
  9. Now you can log into the CubeBackup console and see that:

    • No files/messages are listed under the user's account on the RESTORE page.
    • The statistical data on the OVERVIEW page has been refreshed to reflect the changes.
    • The purged user has now been deselected from the SETTINGS > Users list and will not be included in future backups.

Remove a specific shared drive

CubeBackup allows you to easily purge specific shared drives from your backup set. Please follow the detailed instructions appropriate for your operating system.

  1. Find the ID of shared drive in the URL of the shared drive's Restore page. Shared drive ID in the URL

    Note: Please write down the Shared Drive ID or save it in a text file. Later, the backup service will be stopped, and this page will be unavailable.

  2. Log in to 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. Open a Windows Command Prompt or Powershell using an Administrator account. Run the cbackup purgeSharedDrive command in the <installation directory>\bin folder, and when prompted, double-check that this is the correct drive to be deleted. Type "yes" to purge all backup data for that specific drive.

    "C:\Program Files\CubeBackup4\bin\cbackup.exe" purgeSharedDrive <shared_drive_id>

    Note:
    (1) If the shared drive has already been deleted in Google Workspace, you can choose to also remove it from the shared drive list in CubeBackup. This will completely delete the shared drive so it will no longer appear in the CubeBackup web console.
    (2) To remove multiple Shared drives at the same time, you can create a batch file that includes the following command for each Shared drive to be removed:

    echo yes | "C:\Program Files\CubeBackup4\bin\cbackup.exe" purgeSharedDrive <shared_drive_id>
  5. 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 
    

  6. Now you can log into the CubeBackup console and see that:

    • No files are listed under the shared drive on the RESTORE page.
    • The statistical data on the OVERVIEW page has been refreshed to reflect the changes.
    • The purged shared drive has now been deselected from the SETTINGS > Shared drives list and will not be included in future backups.
  1. Find the ID of shared drive in the URL of the shared drive's Restore page. Shared drive ID in the URL

    Note: Please write down the Shared Drive ID or save it in a text file. Later, the backup service will be stopped, and this page will be unavailable.

  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 purgeSharedDrive command to purge all backup data for the specific shared drive.

    sudo -u cbuser /opt/cubebackup/bin/cbackup purgeSharedDrive <shared_drive_id>

    Note:
    (1) This command requires special privileges and must be run by the cbuser account.
    (2) If the shared drive has already been deleted in Google Workspace, you can choose to also remove it from the shared drive list in CubeBackup. This will completely delete the shared drive so it will no longer appear in the CubeBackup web console. (3) To remove multiple Shared drives at the same time, you can create a bash script that includes the following command for each Shared drive to be removed:

    yes | sudo -u cbuser /opt/cubebackup/bin/cbackup purgeSharedDrive <shared_drive_id>
  5. After running this command, you will need to start the CubeBackup service.

    sudo /opt/cubebackup/bin/cbsrv start
  6. Now you can log into the CubeBackup console and see that:

    • No files are listed under the shared drive on the RESTORE page.
    • The statistical data on the OVERVIEW page has been refreshed to reflect the changes.
    • The purged shared drive has now been deselected from the SETTINGS > Shared drives list and will not be included in future backups.

The cbackup purgeSharedDrive command will remove the backup data of a specific Shared Drive. However, this command can only work after the CubeBackup service has stopped. This means that you need to stop the docker container before running the command, but that, in turn, makes running the cbackup purgeSharedDrive command a bit tricky. Please carefully follow the instructions below to purge the backup data for a specific Shared Drive from the storage.

  1. Find the ID of shared drive in the URL of the shared drive's Restore page. Shared drive ID in the URL

    Note: Please write down the Shared Drive ID or save it in a text file. Later, the backup service will be stopped, and this page will be unavailable.

  2. Find the container id for CubeBackup:

    docker ps -a
  3. Stop the CubeBackup container:

    docker stop <container_id>
  4. Commit the stopped container into a new image (for example, cube/tmp_img):

    docker commit <container_id> cube/tmp_img

    This command saves the modified container state into a new image.

  5. Start a new docker based on the new temporary image with a bash command.

    Please note that you need to mount the volumes exactly as they were in the original CubeBackup docker container so that the new container can properly access the backup data. For example:

    docker run -ti   \
    -v /var/cubebackup_index:/cubebackup_index \
    -v /var/cubebackup_data:/cubebackup_data \
    --mount source=cube_cfg,target=/opt/cubebackup/etc \
    --mount source=cube_db,target=/opt/cubebackup/db \
    --mount source=cube_log,target=/opt/cubebackup/log \
    cube/tmp_img \
    /bin/bash
  6. Now in the bash shell of the new docker, install the sudo command:

    yum install sudo -y
  7. Run the cbackup purgeSharedDrive command in the docker container.

    sudo -u cbuser /opt/cubebackup/bin/cbackup purgeSharedDrive  <shared_drive_id>

    When prompted, type "yes" to confirm, and CubeBackup will delete the backup data for the specified shared drive. Depending on the size of the shared drive's data, this process may take quite a while.

    Note: If the user has already been deleted in Google Workspace, you can choose to also remove it from the user list in CubeBackup. This will completely delete the user so it will no longer appear in the CubeBackup web console.

  8. After the cbackup purgeSharedDrive command has successfully completed, type exit to stop and exit the temporary container.

  9. Restart the original CubeBackup container.

    docker start <container_id>
  10. Now you can log into the CubeBackup console and see that:

    • No files are listed under the shared drive on the RESTORE page.
    • The statistical data on the OVERVIEW page has been refreshed to reflect the changes.
    • The purged shared drive has now been deselected from the SETTINGS > Shared drives list and will not be included in future backups.