This repository contains a bash script to automate the backup of VMs and LXC containers on Proxmox VE7 / VE8. The script performs weekly backups, uploads them to separate Google Drive accounts using Rclone, and manages old backups by automatically deleting them after a specified period.
- GitHub Username: Lalatendu Swain
- Repository URL: https://github.com/Lalatenduswain/Automated-Proxmox-Backup
- Script Name:
Automated-Proxmox-Backup.sh
- Prerequisites
- Installation and Configuration
- Usage
- Scheduling Backups
- Disclaimer | Running the Script
- Donations
- Support or Contact
Before running this script, ensure you have the following installed and configured on your Proxmox VE 7 server:
-
Proxmox VE 7: Ensure that your system is running Proxmox VE 7.
-
Rclone: Install Rclone to manage Google Drive connections.
- Installation:
sudo apt update sudo apt install rclone
- Configure Rclone for each of your Google Drive accounts. Example:
rclone config
- Follow the prompts to configure each Google Drive remote (e.g.,
citplvmbackup1
,citplvmbackup2
,citplvmbackup3
).
- Follow the prompts to configure each Google Drive remote (e.g.,
- Installation:
-
Bash Shell: The script is written in bash, so ensure you have a bash shell available.
-
Proxmox Permissions: You need root or equivalent sudo permissions to run the backup command (
vzdump
) and manage system files.- Ensure you can run the script with root privileges:
sudo bash Automated-Proxmox-Backup.sh
- Ensure you can run the script with root privileges:
-
Clone the Repository: Begin by cloning the repository to your Proxmox server.
git clone https://github.com/Lalatenduswain/Automated-Proxmox-Backup.git cd Automated-Proxmox-Backup
-
Script Configuration: The script is pre-configured to work with specific VMs or LXC containers. You can modify the
VM_RCLONE_MAP
section to adjust the VM IDs and corresponding Rclone remotes if needed. -
Set Execute Permissions: Ensure the script has execute permissions.
chmod +x Automated-Proxmox-Backup.sh
To run the backup and upload script manually, execute the following command:
sudo ./Automated-Proxmox-Backup.sh
The script will:
- Backup the specified VMs and LXC containers.
- Compress the backup files using
zstd
. - Upload the backup files to the corresponding Google Drive accounts via Rclone.
- Automatically delete old backup files based on the retention period (default: 7 days).
The script iterates through the VM IDs and performs the following actions:
- Backup: It uses the
vzdump
command to create a backup with Zstd compression. - Upload: The backup file is uploaded to the appropriate Google Drive account using Rclone.
- Cleanup: Old backups are deleted from the local directory based on the retention period.
To automate the backup process, you can schedule the script using cron
.
- Edit Crontab: Open the crontab file.
crontab -e
- Add Cron Job: Add the following line to schedule the script to run every Sunday at 2 AM:
Replace
0 2 * * 0 /path/to/Automated-Proxmox-Backup.sh
/path/to/Automated-Proxmox-Backup.sh
with the actual path to the script.
Author: Lalatendu Swain | GitHub | Website
This script is provided as-is and may require modifications or updates based on your specific environment and requirements. Use it at your own risk. The authors of the script are not liable for any damages or issues caused by its usage.
If you find this script useful and want to show your appreciation, you can donate via Buy Me a Coffee.
Encountering issues? Don't hesitate to submit an issue on our GitHub page.