Unable to Backup VMs to External Drive

naupe

Member
Apr 8, 2019
36
4
13
37
Hello Proxmox Community,

So I bought this External Drive (10 TB) for my Dell PowerEdge R710 Server running Proxmox as the Host OS. I've been following this video tutorial to properly partition and setup the 10TB External Drive for backups. The setup was easy (it's set to ext4) and Proxmox GUI is recognizing my 10TB Drive (as /dev/sdb)

Now the problem: Backups don't work. When I tried to backup a VM, at first, I was getting the following:
Code:
"TASK ERROR: The hook script '/root/empty-ram-backup.sh' is not executable"

So I changed the permissions of /root/empty-ram-backup.sh to 777 so it would be executable. Now when I try to backup a VM, I get this:

Code:
INFO: starting new backup job: vzdump 104 --compress zstd --remove 0 --node pve --mode snapshot --storage local-usb
INFO: /root/empty-ram-backup.sh: line 3: syntax error near unexpected token `then'
INFO: /root/empty-ram-backup.sh: line 3: `it { "$1" == "backup-start" ]; then'
INFO: /root/empty-ram-backup.sh: line 3: syntax error near unexpected token `then'
INFO: /root/empty-ram-backup.sh: line 3: `it { "$1" == "backup-start" ]; then'
TASK ERROR: command '/root/empty-ram-backup.sh job-abort' failed: exit code 2

I've tried LZO, GZIP and ZSTD Compression. I've tried backing up different VMs, and both On and Off. I even tried backing up to local as opposed to my new USB Drive. All still the same error every time.

Any idea what's going on? The odd thing is that I used to be able to perform backups (I was using an older version of Proxmox at the time), but I can't seem to anymore. I'm currently on 6.4-13.
 
Last edited:
OK, I think I fixed the problem!

I took a look at the /root/empty-ram-backup.sh script. Here were its initial contents:
Code:
#!/bin/bash

it { "$1" == "backup-start" ]; then
        echo 1 > proc/sys/vm/drop_caches
fi

Clearly the Syntax is incorrect. Never touched this file until now, so no idea why there are Syntactical errors. I'm not much of a Bash Scripter, but I believe I've fixed the Syntax:
Code:
#!/bin/bash

if [[ $1 == "backup-start" ]]
then
        echo 1 > proc/sys/vm/drop_caches
fi

And eureka! The VM Backup is working!

Code:
INFO: starting new backup job: vzdump 104 --compress lzo --remove 0 --node pve --mode stop --storage local-usb
INFO: Starting Backup of VM 104 (qemu)
INFO: Backup started at 2022-02-17 00:14:30
INFO: status = running
INFO: backup mode: stop
INFO: ionice priority: 7
INFO: VM Name: Ubuntu-14-VM
INFO: include disk 'scsi0' 'local-lvm:vm-104-disk-0' 50G
INFO: stopping vm
INFO: snapshots found (not included into backup)
INFO: creating vzdump archive '/mnt/usb-drive/dump/vzdump-qemu-104-2022_02_17-00_14_30.vma.lzo'
INFO: starting kvm to execute backup task
INFO: started backup task '1d7aaf3c-dd66-44ba-9ee3-5c3ae0e97d97'
INFO: resuming VM again after 10 seconds
INFO:   0% (459.5 MiB of 50.0 GiB) in 3s, read: 153.2 MiB/s, write: 31.8 MiB/s
INFO:   1% (594.5 MiB of 50.0 GiB) in 6s, read: 45.0 MiB/s, write: 36.9 MiB/s
...

Why was the Syntax in such a simple script so bad!?
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!