Relocating the Podman data storage

If the space in the file system that Podman uses to maintain images, containers and data volumes is not adequate, you must relocate the 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 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 and store the paths in environment variables:
    # to get the 'graphroot' value; default: 
    # /home/<username>/.local/share/containers/storage
    OLD_GRAPH_PATH=$( podman info -f '{{ .Store.GraphRoot }}' )
    # to get the 'runroot' value; default: 
    # /run/user/<numeric_userid>/containers
    OLD_RUN_PATH=$( podman info -f '{{ .Store.RunRoot }}' )
    
  3. Shut down all the Podman containers:
    cd <ZOA_HOME>
    ./bin/podmanManageZoa.sh down
  4. Remove the state database from the currently used graphroot path:
    rm -f ${OLD_GRAPH_PATH}/libpod/bolt_state.db
  5. Create a directory ${HOME}/.config/containers:
    mkdir -p ${HOME}/.config/containers
  6. Create the top-level directory structure where you want the Podman storage to be located, for future updates. 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
  7. Copy the /etc/containers/storage.conf file into ${HOME}/.config/containers/:
    cp /etc/containers/storage.conf ${HOME}/.config/containers/
  8. 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: Do not set runroot and graphroot to the same value; use different values. For example:
    runroot = "/newfs/run/containers/storage"
    graphroot = "/newfs/graph/containers/storage"
  9. Verify that Podman recognizes the storage configuration changes:
    podman info -f '{{ .Store.GraphRoot }}'
    podman info -f '{{ .Store.RunRoot }}'
    
  10. 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 -
  11. List the available Podman container images to make sure that Podman correctly recognizes the new storage location:
    podman images
  12. Start the Podman containers again:
    cd <ZOA_HOME>
    ./bin/podmanManageZoa.sh up
  13. Once you have verified that the containers are fully functional using the new storage locations, remove the files and directories from the old storage locations:
    sudo rm -Rf ${OLD_GRAPH_PATH}/[a-z]*
    sudo rm -Rf ${OLD_RUN_PATH}/[a-z]*