56 lines
No EOL
2.1 KiB
Markdown
56 lines
No EOL
2.1 KiB
Markdown
# 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](https://www.cyberciti.biz/faq/noninteractive-shell-script-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:
|
|
```bash
|
|
systemctl restart sshd
|
|
```
|
|
|
|
## Usage
|
|
|
|
To use the script for backup and restore operations, execute the following commands:
|
|
|
|
- To backup a volume:
|
|
```bash
|
|
./proxmox.sh backup --host <host> --user <user> --lxc <lxc_number> --volume <volume> --path <path>
|
|
```
|
|
|
|
- To restore a volume:
|
|
```bash
|
|
./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:
|
|
```bash
|
|
./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:
|
|
```bash
|
|
./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. |