Proxmox LXC Docker Backup and Restore
Find a file
2024-09-30 09:17:18 +05:30
proxmox.sh Add proxmox.sh 2024-09-30 09:17:18 +05:30
README.md Add README.md 2024-09-30 09:14:16 +05:30

Proxmox Docker Volume Backup and Restore Script

This script performs backup and restore operations for Docker volumes within Proxmox LXC containers.

Requirements

  • Ensure that sshpass is installed. For installation instructions, visit: Cyberciti: SSH Password Provider.
  • Root login with a password must be enabled on the Proxmox host. Follow these steps:
    1. Edit the /etc/ssh/sshd_config file and apply the following configuration settings:
      • ListenAddress 0.0.0.0
      • PasswordAuthentication yes
      • PermitRootLogin yes
    2. Restart the SSH service using the command:
      systemctl restart sshd
      

Usage

To use the script for backup and restore operations, execute the following commands:

  • To backup a volume:

    ./proxmox.sh backup --host <host> --user <user> --lxc <lxc_number> --volume <volume> --path <path>
    
  • To restore a volume:

    ./proxmox.sh restore --host <host> --user <user> --lxc <lxc_number> --volume <volume> --path <path>
    

Parameters

  • host: Proxmox host IP address or hostname
  • user: Proxmox host username
  • lxc: LXC container number
  • volume: Name of the Docker volume
  • path: Path for the backup location

Examples

  • To backup a volume:

    ./proxmox.sh backup --host 192.168.0.100 --user root --lxc 100 --volume searxng_data --path /Users/hhf/backup
    

    The backup file will be saved to /Users/hhf/backup/hhf_data-backup.tar.gz.

  • To restore a volume:

    ./proxmox.sh restore --host 192.168.0.100 --user root --lxc 100 --volume searxng_data --path /Users/hhf/backup
    

    The backup file will be restored from /Users/hhf/backup/searxng_data-backup.tar.gz, so please ensure that the file exists. This action will overwrite existing files within the Docker volume.

Disclaimer

This script is intended for experienced users. Ensure that you understand the implications of backing up and restoring Docker volumes in your environment before using this script.