JTok / unraid.vmbackup

a plugin for backing up VMs in unRAID including vdisks and configuration files.
51 stars 4 forks source link

Backup fails for VMs with passed-through SATA drives #28

Open Nemezor opened 3 years ago

Nemezor commented 3 years ago

Hi, I've been using your plugin for a few weeks now and it has been awesome, I do have one issue though.

The issue

When I try to backup my TrueNAS VM - which has SATA drives passed through to the VM - it fails with the following error in the log:

error: unsupported configuration: source for disk 'hdd' is not a regular file; refusing to generate external snapshot name

This is to be expected since it is trying to backup a raw physical disk, it would be amazing if a check could be added whether the file it is trying to backup is an actual disk image or a physical disk.

I am using the snapshot functionality for backups, but I don't think that is really related, perhaps if I wasn't using it, it would actually try to copy the entire physical drive instead of failing on not being able to create a snapshot of it, which would arguably be even worse...

For reference here is the VM XML regarding the disks, top is the standard qcow2 boot disk and the bottom one is the physical pass-through.

    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='writeback'/>
      <source file='/mnt/user/domains/TrueNAS/vdisk1.img' index='6'/>
      <backingStore/>
      <target dev='hdc' bus='sata'/>
      <boot order='1'/>
      <alias name='sata0-0-2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='2'/>
    </disk>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source dev='/dev/disk/by-id/ata-WDC_WD20EZRZ-00Z5HB0_WD-WCC4M3XVTR40' index='5'/>
      <backingStore/>
      <target dev='hdd' bus='sata'/>
      <alias name='sata0-0-3'/>
      <address type='drive' controller='0' bus='0' target='0' unit='3'/>
    </disk>

Possible workarounds

I guess it could be done by checking whether the file is a regular file?

The vdisk backup skip list could also be expanded to accommodate a user defined string/path, because currently I can't work around this issue by telling it to not backup those physical disks since they don't show up. image