How to change backup locations

1. Prerequisites

a. Ensure the new backup location has the same ownership as the instance (the amp user and group on Linux, the Network Service user on Windows). Also ensure that the relevant user has access to the path to that location.

b. Use separate sub-directories for each instance, so that backups don’t mix. This will be explained further below.

Note:
This guide uses the host location /media/backups as an example. Your actual new backup location can vary - adjust the instructions below as required.

2. Changing the backup location for individual instances

2.1 General setup

The instance needs to be told where to send backups:

a. Stop the instance.

b. In the ADS File Manager or AMP’s SFTP, edit LocalFileBackupPlugin.kvp in the instance’s directory.

c. Change the location for Storage.StorePath to the new location:

Storage.StorePath=/media/backups/{{InstanceName}}/ 

d. Save and exit the file, then start the instance in ADS.

Note:

  • The variable {{InstanceName}} used above will place the backups in their own subfolder based on the instance name. You can also specify the actual instance name (such as Minecraft01), or any other unique name, as desired. A unique name is important for backup separation in the new location.
  • Ensure you have a trailing slash on the path value.

2.2 Instances in Docker

For instances in Docker containers, additional setup is needed.

This is because, for those instances, the location specified under 2.1 will be interpreted as a location within the container. Locations within containers don’t automatically map to locations on the host, unless the host locations are “mounted” into the container:

a. Click on the “pencil” icon on the instance from ADS.

b. Go to the Storage tab.

c. Add the following:

  • Physical Path (the path on the host): /media/backups
  • Virtual Path (the path in the container): /media/backups

d. Click + to save.

Note:
The above approach will make everything in /media/backups on the host available in the Docker container. That may include backups from other instances, if you configure the above for those other instances too. If you don’t want that, you should mount a unique location on the host to the location in the Docker container, like /media/backups/Minecraft01. Ensure that the location exists on the host and has the right ownership.

3. Changing the backup location for all new instances

Rather than individually editing instances after they are created to specify a different backup location, you can configure AMP to create new instances with the new backup location settings you want.

3.1 General setup

New instances needs to be told where to send backups:

a. In ADS, navigate to Configuration->Instance Deployment->Deployment Defaults->Default Settings.

b. Add the following:

  • Node: LocalFileBackupPlugin.Storage.StorePath
  • Value: /media/backups/{{InstanceName}}/

c. Click + to save.

Note:

  • The variable {{InstanceName}} used above will place the backups in their own subfolder based on the instance name. A unique name is important for backup separation in the new location.
  • Ensure you have a trailing slash on the path value.

3.2 Instances in Docker

For instances that will be created in Docker containers, additional setup is needed. This is for the same reason as explained in 2.2 above:

a. In ADS, navigate to Configuration->Instance Deployment->Deployment Defaults->Default Mount Bindings.

b. Add the following:

  • Host Path (the path on the host): /media/backups
  • Container Path (the path in the container): /media/backups

c. Click + to save.

Note:
The above approach will make everything in /media/backups on the host available in the each Docker container created with the above setting. That will include backups from other instances that are created with the above setting. If you don’t want that, don’t include the above, but configure a unique location on the host for individual instances after creation - see the Note in 2.2 above.

4. Showing the changed backup location in the instance file manager

Depending on where your new backup location is for a particular instance , you may not be able to view it in the instance’s file manager. This can be fixed, if you do want to see the location.

4.1 Showing for individual instances

a. Go to Configuration->File Manager->Virtual Directories.

b. Add the following:

  • Display Name (the name of the virtual directory displayed in the file manager): backups
  • Directory (the path to the backup location): /media/backups

c. Click + to save.

d. Restart the instance.

Note:
For Docker instances, use the path as mounted in the container, not the host path, if these are different.

4.2 Showing for all new instances

a. In ADS, navigate to Configuration->Instance Deployment->Deployment Defaults->Default Settings.

b. Add the following:

  • Node: FileManagerPlugin.FileManager.AdditionalVirtualDirectories
  • Value: {"backups":"/media/backups"}

c. Click + to save.