Backing up the server data on Ubuntu

When you want to upgrade to a new version of the server software or to move your existing environments to new systems, you must back up the server data.

Before you begin

You must have completed the following tasks:

  • Been assigned the same role that was required to install and uninstall the server software.

  • Been granted with the sudo access.

  • Installed the server software and all of the HCL OneTest Server pods are in Running state.

  • Communicated to the users that HCL OneTest Server might be unavailable for some time until the process is complete.

Procedure

  1. Log in to the Ubuntu server and open a terminal.
  2. Add the software registry to Helm by running the following command:
    helm repo add hclsoftware https://hclcr.io/chartrepo/ot
  3. Run the following command to extract the base:
    helm pull --untar hclsoftware/hcl-onetest-base --version 8.1023.0
  4. Change to the hcl-onetest-base directory.

    This directory contains the backup.sh script which is required to complete the backup operation.

  5. Create a directory that contains metadata related to the Persistent Volume Claims and their Persistent Volumes by running the following command:
    sudo ./backup.sh create-pvc-links

    You can use the following optional parameter along with the create-pvc-links command:

    --volumes or -v: Use this parameter to specify the directory path of the Volumes.

    For example, backup.sh create-pvc-links -v hcl-onetest-base/my-pvc-links creates a directory called my-pvc-links that stores the metadata required for backup.

    Remember:
    • If you did not provide the volume parameter, by default, the command creates a sub-directory in the same directory where you have the backup script.

    • You must ensure that the directory you create must be empty or not exist to avoid script failure.

    • If you specify a directory by using the -v parameter, then you must use the same parameter value when you restore the data.

  6. Run the following command to stop the cluster and HCL OneTest Server:
    k3s-killall.sh
  7. Run the following command to create a backup of the existing user data:
    sudo ./backup.sh create [options] <backup-file-name>

    After you run this command, a backup of the local Persistent Volumes is created. The backup is created as tar archives that is compressed by using gzip (.tar.gz). The create command archives the Persistent Volumes into the <backup-file-name>.

    You can use the following parameters along with the create command:

    • --namespace or -n: Use this parameter to back up the Persistent Volumes in the specified namespace. If you do not mention the namespace, then all the Volumes from all the namespaces are included in the backup. The syntax is:
      -namespace <name of the namespace>
    • --volumes or -v: Use this parameter to specify the directory path of the Volumes. The syntax is:
      -volumes <path-of-the-directory>
      Remember:
      • If you did not provide the volume parameter, by default, the command creates a sub-directory in the same directory where you have the backup script.

      • If you specify a directory by using the -v parameter, then you must use the same parameter value when you restore the data.

    For example,
    sudo ./backup.sh create --namespace test-system my-backup.tar.gz
    This command creates a backup file named my-backup.tar.gz that contains all of the Persistent Volumes associated with pods available in the test-system namespace.
  8. Run the following command to restart the cluster and HCL OneTest Server:
    sudo systemctl start k3s

Results

You have backed up the data of HCL OneTest Server.