How to move the data index to another location?


What is the data index?

The data index in CubeBackup acts as a cache to speed up the backup process. It contains a part of the metadata for your backup, including SQLite database files, configuration files, and other information used in the backup process. For more information about the data index, please refer to What is the data index and why is it needed?

In some scenarios, you may need to move the data index to a new place. For example:

  • The partition where the data index is stored is nearly full. You need to move the data index to a larger partition.
  • In the initial configuration, you placed the data index on an HDD or network storage, which slows down your backups. Now you decided to move the data index to an SSD.


There are 2 methods to move the data index to a new location:

Method 1: Move the data index to a new directory.

  1. In the CubeBackup web console, stop the current backup job if it is running.

  2. Stop the CubeBackup service.

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

    sudo /opt/cubebackup/cbsrv stop
    

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

  3. Create a new directory in the new storage location and copy everything from the original data index directory to this new location.

    After the data index has been copied over, the new data index directory should look like this: the directory of data index

  4. Modify the <cubebackup installation directory>/db/storage.json file, by changing the value of “IndexPath” to the new directory.
    Tips:

    • On Windows, CubeBackup is installed in the “C:\Program Files\CubeBackup4” directory by default.
      On Linux, CubeBackup is installed in the “/opt/cubebackup” directory by default.
    • On Windows, please use double backslashes to separate the directory path. For example:

      "IndexPath": "C:\\backups\\cube_index"
      
  5. Restart the CubeBackup service.

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

      sudo /opt/cubebackup/cbsrv start
      
    • 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 Start.

Method 2: Regenerate the data index in a new directory.

  1. In the CubeBackup web console, stop the current backup job if one is running.

  2. Stop the CubeBackup service.

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

    sudo /opt/cubebackup/cbsrv stop
    

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

  3. Merge the data index cache to backup storage using the command:

    cbackup syncDataIndex
    

    NOTE: This command needs to be run using a special account.

    • On Windows, by default, the cbackup.exe command is located in “C:\Program Files\CubeBackup4\bin” directory. You need to run the cbackup syncDataIndex command as an administrator.
    • On Linux, this command must be run by the user cbuser.

      sudo -u cbuser  /opt/cubebackup/bin/cbackup syncDataIndex
      
  4. Create a new directory on the new storage, then modify the <cubebackup installation directory>/db/storage.json file by changing the value of “IndexPath” to the new directory.

    Tips:

    • On Windows, CubeBackup is installed in the “C:\Program Files\CubeBackup4” directory by default.
      On Linux, CubeBackup is installed in the “/opt/cubebackup” directory by default.

    • On Windows, please use double backslashes to separate the directory path. For example:

      "IndexPath": "C:\\backups\\cube_index"
      
  5. Restart the CubeBackup service.

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

    sudo /opt/cubebackup/cbsrv start
    

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

  6. CubeBackup will automatically regenerate the data index in the new directory.