Skip to main content
Community Scripts logo
Skip to Content
Tools & Add-onsPVE Tools

PVE Host Backup

Pack selected files and directories of the Proxmox VE host, by default from /etc, into a tar.gz archive.

host-backup.sh creates a compressed archive of files and directories you pick from one directory on the host. Its typical use is saving /etc (with /etc/pve) before an upgrade.

Website entry: host-backup. Source: tools/pve/host-backup.sh.

Run

In the Proxmox VE host shell, as root:

bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/host-backup.sh)"

Prompts

The script runs in a loop: after each backup it returns to the first dialog, so you can make several archives in one session. Answer No there to leave.

DialogInputEffect
"This will create backups for particular files and directories located within a designated directory. Proceed?"Yes / NoNo ends the script.
"Directory to backup to:"Path, default /root/Where the archive is written.
"Directory to work in:"Path, default /etc/The directory whose entries you choose from.
"Select what files/directories to backup:" (checklist)ALL or individual entries of the work directoryWhat goes into the archive.
Press ENTER to continue...EnterStarts tar after showing target and selection.

Cancel in an input box or the checklist returns to the first dialog.

Result

tar -czf "<backup dir><hostname><work dir with - instead of />backup-<YYYY_MM_DDTHH_MM>.tar.gz" --absolute-names <selection>

With the defaults on a host named pve the file is /root/pve-etc-backup-2025_01_31T14_05.tar.gz. Paths are stored absolute, so restore single files with, for example:

mkdir -p /tmp/restore
tar -xzf /root/pve-etc-backup-2025_01_31T14_05.tar.gz -C /tmp/restore

and copy what you need from /tmp/restore/etc/....

Environment variables

VariableDefaultPurpose
COMMUNITY_SCRIPTS_CORE_URLhttps://raw.githubusercontent.com/community-scripts/core/mainBase URL the script loads api/api.func from.

Limits

  • Type both paths with a trailing slash. The script joins the strings as they are: /mnt/backups without the slash produces a file named /mnt/backupspve-....
  • ALL selects the sub-directories of the work directory only. Files directly in it, such as /etc/fstab or /etc/hosts, are not included; tick them individually instead.
  • The script has no restore function.
  • As the script says at the end: a backup that stays on the host does not protect against losing the host. Copy the archive elsewhere.