Relocating the Podman data storage

If the space in the file systems that Podman uses to maintain images, containers, and data volumes is not adequate and cannot be increased, you must relocate the Podman graphroot and runroot directories.

Procedure

When you run the Z Data Analytics Platform under a non-root user ID, you must complete the following steps to relocate the storage directories:

  1. Log in to the system where the Z Data Analytics Platform is hosted under the user ID that is used to run podmanManageZoa.sh.
  2. Obtain the paths that are used for the Podman storage for the user ID under which podmanManageZoa.sh is run, and then store the paths in environment variables:
    OLD_GRAPH_PATH=$( podman info -f '{{ .Store.GraphRoot }}' )   # to get the 'graphroot' value; default: /home/<username>/.local/share/containers/storage
    OLD_RUN_PATH=$( podman info -f '{{ .Store.RunRoot }}' )       # to get the 'runroot' value; default: /run/user/<numeric_userid>/containers
  3. Shut down all the Podman containers:
    cd <ZOA_HOME>
    ./bin/podmanManageZoa.sh down
  4. Create a backup of the following files in case you need to restore the current configuration:
    • ${OLD_GRAPH_PATH}/libpod/bolt_state.db
    • ${OLD_GRAPH_PATH}/[a-z]*
    • ${OLD_RUN_PATH}/[a-z]*
  5. Remove the state database from the currently used graphroot path:
    rm -f ${OLD_GRAPH_PATH}/libpod/bolt_state.db
  6. Create a directory ${HOME}/.config/containers:
    mkdir -p ${HOME}/.config/containers
  7. Create the top-level directory structure where you want the Podman storage to be located, going forward. Also, make sure that the directory has write permission for the user ID under which podmanManageZoa.sh runs.
    For example, if the new top-level directory is /newfs, run the following commands:
    sudo mkdir /newfs
    sudo chmod 777 /newfs
  8. Copy the file /etc/containers/storage.conf into ${HOME}/.config/containers/:
    cp /etc/containers/storage.conf ${HOME}/.config/containers/
  9. Edit the file ${HOME}/.config/containers/storage.conf and change the values for runroot and graphroot to locations on a file system with sufficient disk space.
    Important: runroot and graphroot must not be set to the same value; use different values. For example:
    runroot = "/newfs/run/containers/storage"
    graphroot = "/newfs/graph/containers/storage"
    Note: When you run the Z Data Analytics Platform under the root user ID, the steps remain the same with one exception: Instead of defining the new storage locations in ${HOME}/.config/containers/storage.conf, you must define them directly in /etc/containers/storage.conf.
  10. If you are running Podman version 5 or later, also update the static_dir variable in /usr/share/containers/containers.conf with the new location for libpod, as shown in the following example:
    static_dir = "/newfs/graph/containers/storage/libpod"
  11. Check whether the new settings are in effect:
    podman info -f '{{ .Store.GraphRoot }}'
    podman info -f '{{ .Store.RunRoot }}'
  12. Move the actual contents of the graphroot and runroot directories that are specified in /etc/containers/storage.conf into their replacements, as specified in ${HOME}/.config/containers/storage.conf:
    cd ${OLD_GRAPH_PATH}
    sudo tar cf - [a-z]* | sudo tar -C <new_graphroot_dir> -xf -
    cd ${OLD_RUN_PATH}
    sudo tar cf - [a-z]* | sudo tar -C <new_runroot_dir> -xf -
  13. List the available Podman container images to make sure that Podman correctly recognizes the new storage location:
    podman images
  14. Start the Podman containers again:
    cd <ZOA_HOME>
    ./bin/podmanManageZoa.sh up
  15. After you are sure that everything works well, remove the files and directories in the old storage locations:
    sudo rm -Rf ${OLD_GRAPH_PATH}/[a-z]*
    sudo rm -Rf ${OLD_RUN_PATH}/[a-z]*