I run my personal web server on a Debian 12 LXC container (CT116) on Proxmox, serving everything from my dog weight tracker to my legacy home automation apps. For a long time I had no structured backup for the /var/www/ folder — and that needed to change. I wanted something simple: weekly snapshots, browseable by date, with the ability to restore a single file without unpacking an entire container backup.
Here is exactly how I set it up.
Why Not Proxmox vzdump?
Proxmox has built-in container backups via vzdump, and I already use those. But restoring a single file from a vzdump archive is clunky — you have to mount the archive and extract just the file you need. For web server content where you might want to roll back one PHP file or a config, a plain dated folder on the NAS is far more practical.
The Plan
A bash script runs weekly on the Proxmox host, uses pct exec to stream a tar archive directly from inside CT116, and extracts it into a dated folder on the QNAP NAS via NFS. Each snapshot is fully browseable from File Station or Windows Explorer. After 8 weeks, old snapshots are pruned automatically.
Why Run the Backup from the Proxmox Host?
CT116 is an unprivileged LXC container. Both CIFS and NFS mounts are blocked at the kernel level in unprivileged containers regardless of AppArmor or capability settings — I spent a good while troubleshooting this before landing on the right solution. Running the backup script from the Proxmox host itself sidesteps the problem entirely, since the host has no such restrictions.
Step 1: Set Up NFS Access on the QNAP
First, enable NFS access on the QNAP for the backup share:
- Control Panel → Network & File Services → NFS Service — ensure NFS is enabled
- Control Panel → Shared Folders → HASS-Backups → Edit Shared Folder Permission → NFS host access — add
192.168.1.14(Proxmox host IP) with read/write access
On the Proxmox host, create the mount point and mount the share:
mkdir -p /mnt/qnap-www-backup
mount -t nfs 192.168.1.95:/HASS-Backups /mnt/qnap-www-backup
To make it persist across reboots, add it to /etc/fstab:
192.168.1.95:/HASS-Backups /mnt/qnap-www-backup nfs defaults,_netdev 0 0
Step 2: Create the Backup Script
Create /usr/local/bin/www-backup.sh on the Proxmox host:
#!/bin/bash
DATE=$(date +%Y-%m-%d)
DEST="/mnt/qnap-www-backup/www-snapshots/$DATE"
mkdir -p "$DEST"
pct exec 116 -- tar czf - /var/www/ | tar xzf - --no-same-owner -C "$DEST"
echo "Backup completed: $DATE" >> /var/log/www-backup.log
# Keep only last 8 weeks
find /mnt/qnap-www-backup/www-snapshots/ -maxdepth 1 -type d -mtime +56 -exec rm -rf {} ;
A few things worth noting:
pct exec 116 -- tar czf - /var/www/streams a compressed tar archive directly from inside CT116 without writing any temporary file--no-same-ownerprevents tar from failing when trying to set file ownership on the NFS share- The
findcommand at the end prunes snapshots older than 56 days (8 weeks)
Make the script executable:
chmod +x /usr/local/bin/www-backup.sh
Step 3: Test It
Run the script once manually:
/usr/local/bin/www-backup.sh
You will see a tar notice about removing the leading slash — that is normal. Verify the snapshot was created:
ls /mnt/qnap-www-backup/www-snapshots/
You should see a dated folder, e.g. 2026-06-09, containing the full var/www/ tree from CT116. The snapshot is also immediately visible in QNAP File Station.
Step 4: Schedule with Cron
On the Proxmox host, open the crontab:
crontab -e
Add this line to run every Sunday at 2:00 AM:
0 2 * * 0 /usr/local/bin/www-backup.sh
Restoring a File
Restoring is as simple as copying the file back from the dated snapshot. For a single file:
cp /mnt/qnap-www-backup/www-snapshots/2026-06-09/var/www/html/wp-config.php /var/www/html/wp-config.php
Or restore an entire folder:
cp -r /mnt/qnap-www-backup/www-snapshots/2026-06-09/var/www/html/wp-content/ /var/www/html/wp-content/
You can also browse snapshots directly in QNAP File Station or Windows File Explorer via the SMB share — no command line needed for a quick visual restore.
Wrapping Up
The key lesson here was that unprivileged LXC containers on Proxmox block both CIFS and NFS mounts regardless of AppArmor or capability settings. Running the backup script from the Proxmox host and using pct exec to stream the archive sidesteps the problem entirely. The result is a clean, lightweight weekly snapshot system with no extra dependencies inside the container — and full file-level restore capability from a plain browseable folder structure on the NAS.
Related Posts
May 30, 2026

