Migration to bind mounted data dir

Migration to bind mounted data dir

By default, the generated GameBench docker-compose.yml will be configured to mount the data directory to a Docker volume. The purpose of this guide is to outline the steps necessary to switch the data volume to a bind mounted data directory. This could, for example, allow you to store data on a mounted NFS share.

1. Identify file data location on disk

Find volume name

$ docker volume ls | grep filedata
local               gb_filedata

Inspect volume

Use the volume name from the previous command to identify the mountpoint.

# Replace gb_filedata with the name of your Docker volume
$ docker volume inspect gb_filedata
[
    {
        "CreatedAt": "2019-08-23T14:26:33Z",
        "Driver": "local",
        "Labels": {
            "com.docker.compose.project": "gb",
            "com.docker.compose.version": "1.23.2",
            "com.docker.compose.volume": "filedata"
        },
        "Mountpoint": "/var/lib/docker/volumes/gb_filedata/_data",
        "Name": "gb_filedata",
        "Options": null,
        "Scope": "local"
    }
]

2. Copy contents to new location

Use the mountpoint from the previous command to copy the data to the new directory.

# Replace /var/lib/docker/volumes/gb_filedata/_data/ and /home/vagrant/gb-data/ with your volume mountpoint and new directory path
$ sudo cp -r /var/lib/docker/volumes/gb_filedata/_data/. /home/vagrant/gb-data/

3. Run gbctl in your gamebench directory to reconfigure

Set the GameBench directory to the new directory path.

# Replace /home/vagrant/gb-data with your new directory path
$ ./gbctl
Bind mount GameBench directory?
        Use this setting if you want to bind mount the GameBench directory on the host.
        (Default: no) (Current: no) yes
GameBench directory
        (Default: ) (Current: ) /home/vagrant/gb-data

4. Restart changed containers

$ docker-compose up -d

5. Update new location with any files uploaded since the previous copy

# Replace /var/lib/docker/volumes/gb_filedata/_data/ and /home/vagrant/gb-data/ with your volume mountpoint and new directory path
$ sudo rsync -a --ignore-existing /var/lib/docker/volumes/gb_filedata/_data/ /home/vagrant/gb-data/
Last updated on