A Podman volume is a mechanism for storing container data directly on the host machine. When you create a volume and attach it to a container, Podman sets up a dedicated directory on your host system. Any data the container writes to this mounted volume is actually written to this host directory. This means that even if you stop, remove, or replace the container, the data remains intact on your host machine. You can then mount this same volume to a new container, allowing it to access all the previously stored data. This also allows you to have one volume on a host machine that you can mount to multiple containers. For instance our certs volume which is used across all containers.
You will see volumes in our quadlets and they will look something like this:
/path/on/host/:/path/in/container/
On the left of the colon would be a path or file on the host machine that is persisted inside the running container (the path on the right of the colon).
NOTE: If you do not have a volume assigned to a certain path or file, it will not be persisted. This means restarting a container will blow away any changes you've made on the running container. We've made sure all required files by default are already volumes.
Managing disk usage is crucial for maintaining the health and performance of your LME installation. Here's how you can monitor and manage the disk space used by Podman volumes.
You can check the location of your volumes on the host machine by running the following command:
podman volume inspect <volume_name>
To get a list of volumes you can run:
podman volume ls
To check the overall disk usage on your system, use the df
command:
df -h
This will show you the disk usage for all mounted filesystems. Look for the filesystem that contains your home directory (usually /
).
By default Podman volumes are stored in your home directory under ~/.local/share/containers/storage/volumes/
. To check the disk usage of this specific directory:
sudo du -sh ~/.local/share/containers/storage/volumes/
This command will show you the total size of all Podman volumes.
To see a breakdown of individual volume sizes:
sudo du -sh ~/.local/share/containers/storage/volumes/*
Podman provides a built-in command to check disk usage of containers, images, and volumes:
podman system df -v
This command will show you:
- A summary of disk usage by images, containers, and volumes
- A detailed breakdown of each volume's size
If you find that your volumes are using too much space, consider the following steps:
- Review the data in large volumes to see if any can be cleaned up or archived.
- For log volumes (like
lme_wazuh_logs
), consider implementing log rotation if not already in place. - For database volumes (like
lme_esdata01
), check if data can be optimized or old indices can be removed. Index management is key for space management with this volume as this will end up your largest volume as elasticsearch collects all your logs and stores them here. - Use Podman's prune commands to remove unused volumes:
Be careful with this command as it will remove all unused volumes.
podman volume prune
Remember to always backup important data before performing any cleanup operations.
As discussed earlier lme_esdata01 will store all your logs in indexes.
To view all your Elasticsearch indexes and their sizes in Kibana:
- Login to Kibana
- Click the "hamburger" menu button top left.
- Scroll down to Stack Management
- Click "Index Management"
- Check the option to "Include Hidden Indices"
You should now see all your indexes and their sizes:
When you edit files that are made available to containers through Podman volumes or bind mounts, these changes are immediately reflected in the running containers. This creates a direct link between files on the host system and within the container's filesystem. In the LME setup, many configuration files use this principle. For example, the Wazuh Manager configuration file (ossec.conf) is actually located at /opt/lme/config/wazuh_cluster/wazuh_manager.conf
on the host and is bind-mounted into the container.
When you edit this file on the host, the changes are instantly visible to the Wazuh manager process inside the container. You could then restart the Wazuh Manager container using:
sudo systemctl restart lme-wazuh-manager.service
Now your changes will be implemented into the running Wazuh Manager container.
Remember that your volumes will be ALL your important data for LME that is persisted. You may want to back this data up to an external hard drive or NAS. Some general steps for doing so:
Stop all containers before performing a backup
To external hard drive:
- Connect external hard drive to your system.
- Mount the hard drive.
- Copy volume data from your Podman volume directory to the mounted drive.
- Safely unmount the drive when finished if desired.
To network storage:
- Mount/Connect to your network storage.
- Copy volume data from your Podman volume directory to the network storage.
- Disconnect/Unmount from the network storage if desired.
Example command you might use to copy all volumes to a mounted drive:
rsync -av ~/.local/share/containers/storage/volumes/ /mnt/nas/podman_volume_backup/
Note: Ensure you use your drive's documentation for connecting/mounting to an Ubuntu instance.**