Phase 8: Backup & Proxmox Backup Server
Bài 8.1: vzdump — backup đơn giản tới NFS/CIFS
Lý thuyết cốt lõi
vzdump = backup truyền thống:
- Output: 1 file
.tar.zst(hoặc.vma.zstcho VM) - Compress: zstd (mặc định VE 9), lzo, gzip
- Không dedup → tốn dung lượng lớn
Bài tập thực hành
Config storage NFS:
# Mount NFS share làm storage backup
pvesm add nfs backup-nfs --server 10.0.30.10 --export /mnt/backup \
--content backup --options vers=4.2
# Backup
vzdump 100 101 102 --compress zstd --storage backup-nfs \
--mode snapshot --mailto [email protected] --mailnotification always
Schedule qua Web GUI: Datacenter → Backup → Add:
- Storage:
backup-nfs - Day: Mon–Sun
- Start time: 02:00
- Selection: All
- Retention:
keep-daily=7,keep-weekly=4,keep-monthly=6
Kết quả đầu ra
INFO: Starting Backup of VM 100 (qemu)
INFO: backup mode: snapshot
INFO: creating vzdump archive '/mnt/pve/backup-nfs/dump/vzdump-qemu-100-2026_04_22-02_00_00.vma.zst'
INFO: status: 5% (500 MiB of 10.0 GiB)
INFO: status: 100% (10.0 GiB of 10.0 GiB)
INFO: Finished Backup of VM 100 (00:05:34)
INFO: Backup finished at 2026-04-22 02:05:34
Troubleshooting
- NFS stale:
umount -f -l /mnt/pve/backup-nfs && pvesm status - Disk full: prune cũ:
vzdump --prune-backups keep-last=3 ...
Bài 8.2: Proxmox Backup Server — dedup + incremental
Lý thuyết cốt lõi
PBS (Proxmox Backup Server) = sản phẩm riêng, install trên server tách (ISO riêng hoặc apt install proxmox-backup-server trên Debian 13).
Ưu điểm:
- Deduplication rolling hash 4 MiB chunk — 1 VM 100 GB backup 30 ngày chỉ tốn ~120 GB (dedup 25×)
- Incremental forever: chỉ sync chunk thay đổi
- Client-side encryption
- Retention policies linh hoạt
- Verification (check chunk còn nguyên vẹn)
- Tape backup (VE 9.1+)
- S3 backend (preview VE 9.1)
Bài tập thực hành
Cài PBS trên server riêng 10.0.30.20:
# Tải PBS ISO + cài như PVE
# Sau cài xong, tạo datastore:
proxmox-backup-manager datastore create big-ds /mnt/backup/pbs
Trên Proxmox VE, add PBS làm storage:
pvesm add pbs pbs-remote \
--server 10.0.30.20 --datastore big-ds \
--username backup@pbs \
--password 'SecureP@ss' \
--fingerprint AB:CD:EF:... \
--content backup
Backup:
# Web GUI: Datacenter > Backup > Add (chọn storage = pbs-remote)
# Hoặc CLI:
vzdump 100 --storage pbs-remote --mode snapshot
Kết quả đầu ra
$ vzdump 100 --storage pbs-remote --mode snapshot
INFO: creating PBS backup for VM 100
INFO: Dump 100 to: vm/100/2026-04-22T11:45:00Z
INFO: total bytes: 10.0 GiB
INFO: unique bytes uploaded: 312 MiB (3.1%) ← chỉ upload chunk mới!
INFO: dedup ratio: 32.2x
INFO: backup is sparse: 0%
INFO: Finished Backup in 00:01:48
Verification job (chạy định kỳ):
# Web GUI PBS: Datastore > Verify Jobs > Add
# Check tất cả chunk còn nguyên (chống bit rot)
Troubleshooting
- Fingerprint mismatch: check PBS certificate, lấy lại:
proxmox-backup-manager cert info - Prune không xóa file: thực tế PBS xoá garbage qua
gcjob (chạy hàng tuần) - Disk full: chạy GC thủ công
proxmox-backup-manager garbage-collection start big-ds
Ứng dụng thực tế
DR strategy 3-2-1:
- 3 copies: primary + PBS local + PBS offsite
- 2 media: disk (local) + tape (offline)
- 1 offsite: replicate PBS → PBS ở DC thứ 2 (feature built-in)
# Replicate PBS → PBS offsite (trên PBS offsite):
proxmox-backup-manager sync-job create sync-primary \
--store big-ds-dr \
--remote primary-pbs.lab.local \
--remote-store big-ds \
--schedule 'daily'
Bài 8.3: Restore từ PBS + file-level restore
Lý thuyết cốt lõi
2 loại restore:
- Full VM restore: tạo VM mới từ backup
- File-level restore: mở backup như archive, copy file cụ thể ra
Bài tập thực hành
Full restore:
# Restore backup 2026-04-22 thành VM ID mới 999
qmrestore pbs-remote:backup/vm/100/2026-04-22T02:00:00Z 999 --storage ceph-rbd
File-level restore (Web GUI PBS: Backup → File Browser → download file).
Hoặc CLI từ PVE:
# Mount backup như filesystem
proxmox-backup-client mount vm/100/2026-04-22T02:00:00Z /mnt/restore \
--repository backup@[email protected]:big-ds
# Browse + copy file cần
cp /mnt/restore/drive-scsi0/etc/nginx/nginx.conf /tmp/
Kết quả đầu ra
$ qmrestore pbs-remote:backup/vm/100/2026-04-22T02:00:00Z 999
restore vma archive: vma extract -v -r /tmp/vzdumptmp.fifo
progress 1% ...
progress 100% ...
rescan volumes...
restore finished successfully
Ứng dụng thực tế
User xoá nhầm file cấu hình → file-level restore trong 30 giây không cần restore toàn VM.