Backup on external USB device (IBM RDX)

genesio

New Member
Jul 25, 2018
18
0
1
43
Hello everyone,
I recently migrated a physical IBM server to a proxmox VM

I would like to re-use the IBM RDX device with removable disks as daily backup target.
First of all, I mounted the /dev/sdd1 device into a /backup folder and configured as a storage entry (type Directory, VZDump selected)

Then I created a specific backup entry in the proxmox GUI, selecting a the folder-mounted backup target.
Everything works as expected.

Now, I would like to automatically mount the device when the backup starts and unmount+eject it when the backup completes successfully.

My first attempt of a custom script (configured in /etc/vzdump.conf) is the following:

Code:
#!/bin/bash

if [ "$1" == "backup-start" ]; then
  echo "mounting RDX..."
  mount /dev/sdd1 /backup
  sleep 10
  echo "...done"
  exit 0
fi

if [ "$1" == "backup-end" ]; then
  if mountpoint -q /backup; then
    echo "RDX is mounted. unmounting..."
    umount /backup
    echo "...done"
    echo "Ejecting RDX..."
    eject /dev/sdd
    echo "...done"
    exit 0
  else
    echo "RDX is not mounted. error"
    exit 1
  fi
fi

Unfortunately the backup fails with this error:

Code:
INFO: starting new backup job: vzdump 108 --compress lzo --mailto xxxx@xxxx --node pve2 --storage cassetta --remove 0 --mode snapshot
INFO: Starting Backup of VM 108 (qemu)
INFO: status = running
INFO: update VM 108: -lock backup
INFO: VM Name: zucchetti-clone
INFO: include disk 'scsi0' 'large:vm-108-disk-0' 1000G
INFO: include disk 'efidisk0' 'large:vm-108-disk-1' 128K
INFO: backup mode: snapshot
INFO: ionice priority: 7
INFO: mounting RDX...
INFO: ...done
ERROR: Backup of VM 108 failed - unable to open '/backup/dump/vzdump-qemu-108-2019_01_20-14_53_09.tmp/qemu-server.conf' at /usr/share/perl5/PVE/VZDump/QemuServer.pm line 188.
INFO: Backup job finished with errors
TASK ERROR: job errors

After the error, I can see that the device is correctly mounted.
If I immediately run the backup again, it works:

Code:
INFO: starting new backup job: vzdump 108 --remove 0 --mode snapshot --storage cassetta --node pve2 --compress gzip --mailto xxxx@xxxx
INFO: Starting Backup of VM 108 (qemu)
INFO: status = running
INFO: update VM 108: -lock backup
INFO: VM Name: zucchetti-clone
INFO: include disk 'scsi0' 'large:vm-108-disk-0' 1000G
INFO: include disk 'efidisk0' 'large:vm-108-disk-1' 128K
INFO: backup mode: snapshot
INFO: ionice priority: 7
INFO: mounting RDX...
INFO: mount: /dev/sdd1 is already mounted or /backup busy
INFO:        /dev/sdd1 is already mounted on /backup
INFO: ...done
INFO: creating archive '/backup/dump/vzdump-qemu-108-2019_01_20-15_14_13.vma.gz'
INFO: started backup task '9743e502-343b-4e0f-8eed-07ff4221e6ef'
INFO: status: 0% (739835904/1073746018304), sparse 0% (460558336), duration 3, read/write 246/93 MB/s
......

What could I be missing?
 
Last edited:
INFO: starting new backup job: vzdump 108 --compress lzo --mailto xxxx@xxxx --node pve2 --storage cassetta --remove 0 --mode snapshot
Now backup starts - a directory /backup/dump/vzdump-qemu-108-2019_01_20-14_53_09.tmp/ is created

But since your external disk is not mounted yet is located in the main file system

INFO: mounting RDX...
INFO: ...done
ERROR: Backup of VM 108 failed - unable to open '/backup/dump/vzdump-qemu-108-2019_01_20-14_53_09.tmp/qemu-server.conf' at /usr/share/perl5/PVE/VZDump/QemuServer.pm line 188.

Now your external disk is mounted at /backup, the previously created directory cannot bee seen any more.

If you start the process again the tmp directory is at the external disk and it will work.

In other words: your request cannot be implemented as you tried. Instead you can make a script containing mount, run backup via cli and finally unmount.