This commit is contained in:
Kaby_Kun 2025-05-24 00:35:02 +02:00
parent 2ff30823d2
commit a9ba074795

118
README.md Normal file
View file

@ -0,0 +1,118 @@
# Proxmox Backup Server to SMB Backup Script
A robust and efficient backup solution for Proxmox Backup Server (PBS) that securely transfers backups to an SMB share. This script provides incremental backups, efficient space management, and detailed logging.
## Features
- 🔄 Incremental backups with file change detection
- 📦 Chunked backup creation for large datasets
- 💾 Efficient space management with configurable chunk sizes
- 🔍 Detailed logging and progress tracking
- 🔒 Secure SMB authentication
- 🧹 Automatic cleanup of old backups
- 🔁 Restore functionality
- 📊 SQLite database for tracking file changes
- ⚡ Optimized performance with batch processing
## Prerequisites
- Linux-based system (tested on Proxmox Backup Server)
- Required packages:
- `sqlite3`
- `7zip`
- `rsync`
- `cifs-utils`
- `pv` (optional, for progress bars)
## Installation
1. Clone the repository:
```bash
git clone https://git.pandem.fr/gabriel/ProxmoxBackupsServer-to-SMB.git
cd ProxmoxBackupsServer-to-SMB
```
2. Make the script executable:
```bash
chmod +x backups2smb.sh
```
3. Configure the script by editing the configuration section at the top of `backups2smb.sh`:
```bash
# === Config ===
SERVER_IP="192.168.2.194" # Your SMB server IP
SHARE_NAME="PBS-back" # SMB share name
MOUNT_POINT="/mnt/smb-backup" # Local mount point
CREDENTIALS_FILE="/root/.smb-pbs-cred" # SMB credentials file
CHUNK_SIZE="10G" # Size of backup chunks
MIN_SPACE_REQUIRED="5G" # Minimum required space in /tmp
```
4. Create the credentials file:
```bash
echo "username=your_username" > /root/.smb-pbs-cred
echo "password=your_password" >> /root/.smb-pbs-cred
chmod 600 /root/.smb-pbs-cred
```
## Usage
### Regular Backup
Run the script without any arguments to perform a regular backup:
```bash
./backups2smb.sh
```
### Restore from Backup
To restore from the latest backup:
```bash
./backups2smb.sh -u
```
## Configuration Options
The script can be customized by modifying the following variables in the configuration section:
- `SERVER_IP`: IP address of your SMB server
- `SHARE_NAME`: Name of the SMB share
- `MOUNT_POINT`: Local mount point for the SMB share
- `CREDENTIALS_FILE`: Path to the SMB credentials file
- `CHUNK_SIZE`: Size of backup chunks (e.g., "10G")
- `MIN_SPACE_REQUIRED`: Minimum required space in /tmp
- `LOG`: Path to the log file
- `SRC`: Directories to backup (space-separated)
## Logging
The script maintains detailed logs at `/var/log/pbs-smb-backup.log`. Logs older than 7 days are automatically cleaned up.
## Error Handling
The script includes comprehensive error handling for:
- Network connectivity issues
- SMB mount failures
- Space constraints
- Process cleanup
- Database operations
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## Contact
For support or questions, please contact:
- Email: gabriel@pandem.fr
## License
This project is licensed under the MIT License - see the LICENSE file for details.
## Acknowledgments
- Thanks to the Proxmox team for their excellent backup server
- Inspired by various backup solutions in the Linux community