I have some experience in this, I fished out this script that I used to use when I was running a 3-cluster Proxmox environment, I don't know where I got it from but you can use it if you'd like,Hi,
I am not sure if this would be the right place to ask questions but I have been struggling with a few things with proxmox and my Dell Optiplex 3070 Micro.
So far as Internet (router) is concerned, I am using the one provided by my ISP only.
The hardware I am using is a Mini PC (Dell Optiplex 3070) with i3 9100T, 24 gb Ram, 512gb sata m.2 ssd and another sata 2.5inch HDD. (HDD is formatted in EXT4)
I have installed proxmox on the m.2 ssd with a 100gb partition and running following VM/LXC
1. VM-Home Assistant (64gb storage in M.2 SSD & 3GB Ram)
2. VM- Open Media Vault (6gb Ram & 40gb storage for OS and another 1.5TB (HDD) thin allocation for data). Currently running qBittorrent and Jellyfin as docker compose.
3. VM- Nextcloud (8gb Ram & 40GB for OS & 512 gb storage in HDD) The 512gb for storage is formatted in ZFS as I did not have much choice while installing. Installed a pre-installed V from hanssonit
4. LXC- Cloudflared: (1gb ram & 8 gb storage in ssd)
Cloud flare LXC is used to provide tunnel to nextcloud, qBittorrent, proxmox and Jellyfin. I have installed another cloudflare addon with home assistant for redundancy.
Coming to the questions (Kindly bear with me)
1. Foremost concern is regarding if my method of installation is correct with regard to storage /formatting / distribution of HDD. I have read most Homelab people separate the compute units and data storage (mostly NAS).
2. The data of HDD is currently not backed up. What solution should I opt - USB External Storage (but how to take data from open media vault & Nextcloud at the same time) or to deploy another vm with Proxmox Backup Server (which again would use another external storage) or to consider spending money on another mini PC to build a NAS with Open Media Vault. (Don't want to spend for another computer and want to get things accomplished). How to go about data backup?
Although I am trying to keep the crucial Vms (Home Assistant & Nextcloud) Backed up in an external USB HDD at regular intervals by mounting the said drive (as the same is in ntfs and contains other data too) when backing up, the said process is lengthy.
I want this Proxmox instance to be deploy and forget (Apart from timely upgrades) while keeping data backed up. (Trying not to spend too much money but I understand I will have to spend some. Atleast to get a dedicated external storage which I currently do not have.)
Save this script to a file, for example, proxmox_backup.sh, and make it executable by running "chmod +x proxmox_backup.sh"
#!/bin/bash
# Proxmox Backup Script
# Set the backup directory
BACKUP_DIR="/path/to/backup/drive"
# Set the Proxmox data directory
PROXMOX_DIR="/var/lib/vz"
# Set the date format for the backup folder
DATE_FORMAT=$(date +"%Y%m%d%H%M%S")
# Create a backup directory with the current date
BACKUP_FOLDER="$BACKUP_DIR/backup_$DATE_FORMAT"
mkdir -p "$BACKUP_FOLDER"
# Backup all VMs
for VMID in $(qm list | awk '$1 ~ /^[0-9]+$/ {print $1}'); do
BACKUP_FILE="$BACKUP_FOLDER/vm_$VMID.vma"
qm backup $VMID $BACKUP_FILE
done
# Backup all LXC containers
for CTID in $(pct list | awk '$1 ~ /^[0-9]+$/ {print $1}'); do
BACKUP_FILE="$BACKUP_FOLDER/ct_$CTID.tar.gz"
pct backup $CTID $BACKUP_FILE
done
# Cleanup old backups (optional)
# Uncomment the following lines to keep only a certain number of backups
# MAX_BACKUPS=5
# ls -1t "$BACKUP_DIR" | tail -n +$(($MAX_BACKUPS+1)) | xargs -I {} rm -r "$BACKUP_DIR"/{}
# Display completion message
echo "Backup completed successfully. Backup stored in: $BACKUP_FOLDER"
Now you can add the above script as a cron job that runs every day at 2 am
Crontab -e
0 2 * * * /path/to/proxmox_backup.sh
I have another that does a backup of all the config so if your system fails and you want your settings you can run the below:
Again save it proxmox_config_backup.sh and make it executable by running "chmod +x proxmox_config_backup.sh" then create the cron job accordingly.
#!/bin/bash
# Proxmox Configuration Backup Script
# Set the backup directory
BACKUP_DIR="/path/to/backup/directory"
# Create a backup directory with the current date
DATE_FORMAT=$(date +"%Y%m%d%H%M%S")
BACKUP_FOLDER="$BACKUP_DIR/config_backup_$DATE_FORMAT"
mkdir -p "$BACKUP_FOLDER"
# Backup Proxmox configuration files
cp -aR /etc/pve/ "$BACKUP_FOLDER"
cp -aR /etc/hostname "$BACKUP_FOLDER"
cp -aR /etc/hosts "$BACKUP_FOLDER"
cp -aR /etc/network/ "$BACKUP_FOLDER"
cp -aR /etc/sysctl.conf "$BACKUP_FOLDER"
cp -aR /etc/modules "$BACKUP_FOLDER"
cp -aR /etc/network/interfaces "$BACKUP_FOLDER"
cp -aR /etc/apt/sources.list "$BACKUP_FOLDER"
cp -aR /etc/apt/sources.list.d/ "$BACKUP_FOLDER"
# Display completion message
echo "Proxmox configuration backup completed successfully. Backup stored in: $BACKUP_FOLDER"