CertGrid CertGrid
Hands-on Lab·Podman

Podman Volume Backup

`podman volume export` writes a plain tar of a volume's contents - no helper container, no `-v $(pwd):/backup` incantation. The restored copy is genuinely independent: the original gains a row and the copy does not.

Storage Guide 34 of 47 Intermediate

Written against the versions above. Podman follows the distribution here rather than a vendor repository, so the version you get is the one Ubuntu shipped. The commands are stable across 5.x.

Every command on this page ran on podman01.
Server NameIP AddressOSRolesCPURAMHDD
PODMAN01192.168.0.24Ubuntu 26.04 LTSPrimary Container Host2 Core4 GB50 GB

Before you start

  1. A volume with something in it

    Two lines of text in a named volume, standing in for whatever your application keeps there.

    bash Example session
    podman volume create dbdatadbdatapodman run --rm -v dbdata:/data docker.io/library/alpine sh -c 'echo "row one" > /data/table; echo "row two" >> /data/table; ls -l /data'total 4-rw-r--r--    1 root     root            16 Aug 22 12:11 tablepodman run --rm -v dbdata:/data docker.io/library/alpine cat /data/tablerow onerow two

    Expected resultA volume containing a two-line file.

    Success conditionThere is data worth backing up.

  2. Export, and look at what you got

    podman volume export dbdata -o ~/dbdata.tar

    That is the whole backup. Worth appreciating if you have done this with Docker, where there is no equivalent and the documented approach is to run a throwaway container with both the volume and a host directory mounted, and tar inside it.

    tar -tvf shows an ordinary archive with paths relative to the volume root:

    -rw-r--r-- 0/0    16 2026-08-22 12:11 table

    No leading directory, and ownership recorded as 0/0 - the in-namespace view. Because it is a plain tar you can inspect it, extract one file from it, or store it anywhere; nothing about it is Podman-specific.

    Restoring needs an existing volume - podman volume create dbrestore first, then import. It will not create the volume for you, which is a small annoyance and a deliberate guard against typos silently making new volumes.

    bash Example session
    podman volume export dbdata -o ~/dbdata.tarls -l ~/dbdata.tar-rw-r--r-- 1 sysadmin sysadmin 2048 Aug 22 12:11 /home/sysadmin/dbdata.tartar -tvf ~/dbdata.tar-rw-r--r-- 0/0              16 2026-08-22 12:11 tablepodman volume create dbrestoredbrestorepodman volume import dbrestore ~/dbdata.tarpodman run --rm -v dbrestore:/data docker.io/library/alpine cat /data/tablerow onerow two

    Expected resultA 2048-byte tar containing table, and the same two rows read back from the new volume.

    Success conditionThe data is in a second volume you restored from a file.

  3. Prove it is a copy, not a link

    Append a third row to the original, then read both:

    dbdata     row one / row two / row three
    dbrestore  row one / row two

    Independent. Obvious once stated, and worth actually checking, because "restored" and "still pointing at the same data" look identical until something diverges.

    What this is and is not. It is a file-level copy of a volume's contents, taken while nothing coordinates the write. For a database that is not a backup you can trust: exporting a running Postgres volume can capture a half-written page and restore to something that will not start. The engine's own dump - pg_dump, mysqldump - is the backup; volume export is right for uploaded files, caches, configuration and anything not being mutated under a transaction.

    For a database volume, stop the container first. A podman stop before the export costs seconds and turns an unreliable copy into a reliable one.

    bash Example session
    podman run --rm -v dbdata:/data docker.io/library/alpine sh -c 'echo "row three" >> /data/table'podman run --rm -v dbdata:/data docker.io/library/alpine cat /data/tablerow onerow twopodman run --rm -v dbrestore:/data docker.io/library/alpine cat /data/tablerow onerow two

    Expected resultThree rows in the original and two in the copy.

    Success conditionYou have shown the two volumes diverge.

Troubleshooting

Official sources