Author: Zeglius
Description: Mount container-storage in a btrfs loopback for space restrained environments
- Description: Path to the container-storage directory. Defaults to the user container-storage (~/.local/share/containers)
- Required: No
- Default:
""
- Note: Set to
/var/lib/containers
in case of using rootful podman,/var/lib/docker
if using docker.
- Description: Mount options for the BTRFS loopback, separated by commas
- Required: No
- Default:
""
- Description: Percentage of the total space to use for the loopback. Max: 1.0, Min: 0.0
- Required: No
- Default:
"0.8"
To use this action, add the following to your workflow file:
- name: Mount BTRFS loopback
uses: zeglius/container-storage-action@v1 # Replace v1 with the desired tag or commit hash
with:
target-dir: /var/lib/containers
mount-opts: compress-force=zstd:2
loopback-free: 0.5
This action executes the mount_btrfs.sh
script, which performs the following steps:
- Determines Target Directory: It first determines the
target-dir
for the container storage. If not provided, it defaults to thepodman
system info's graph root. - Installs
btrfs-progs
: Ensures that thebtrfs-progs
package is installed on the system. - Creates Loopback File: A loopback file is created based on the available free space in the directory where the loopback file will reside. The size is determined by the
loopback-free
input. - Formats Loopback File: The created loopback file is then formatted as a BTRFS filesystem.
- Mounts Loopback: Finally, the BTRFS loopback file is mounted to the
target-dir
usingsystemd-mount
, applying any specifiedmount-opts
.
This project is licensed under the Apache License, Version 2.0 - see the LICENSE file for details.