don't use compression

This commit is contained in:
adam committed 2026-01-12 15:28:42 +00:00
1 parent 2077d886cc
commit ae4f8e685d
1 file changed
+3 -3
+3 -3
View File
@@ -79,20 +79,20 @@ start_backup() {
local vm=$1
local backup_base="$2"
local destination="${backup_base}/${vm}"
local backup_name="${vm}_$(date +"%Y-%m-%d_%H-%M-%S").tar.gz"
local backup_name="${vm}_$(date +"%Y-%m-%d_%H-%M-%S").tar"
[[ -d "$backup_base" ]] || { echo "${backup_base} is not a directory"; exit 1; }
[[ -d "$destination" ]] || mkdir "$destination"
[[ -f "${destination}/${backup_name}" ]] && { echo "Backup already exists"; return 2; }
lxc export "$vm" --instance-only "${destination}/${backup_name}" || { echo "Error exporting $vm"; return 1; }
lxc export "$vm" --instance-only --compression none "${destination}/${backup_name}" || { echo "Error exporting $vm"; return 1; }
[[ -n "$run_cleanup" ]] && prune_backups "$destination"
}
prune_backups() {
local backup_directory="$1"
mapfile -t backup_files < <(find "$backup_directory" -maxdepth 1 -name "*.tar.gz" -printf '%T@ %p\n' | sort -n | head -n "-${files_to_keep}" | cut -d' ' -f2-)
mapfile -t backup_files < <(find "$backup_directory" -maxdepth 1 -name "*.tar" -printf '%T@ %p\n' | sort -n | head -n "-${files_to_keep}" | cut -d' ' -f2-)
if [[ ${#backup_files[@]} -gt 0 ]]; then
echo "Removing ${#qcow2_files[@]} old backup files for $vm (keeping last $total_files_to_keep files)"