[SOLVED] Restore single file from VM backup

larsen

Well-Known Member
Feb 28, 2020
160
19
58
Hello,

I understand that it is possible to restore a single file from a backup when using the proxmox-backup-client but not when using PVE/PBS, is that correct?

Tried the following ways and had the following problems:
1) https://pbs.proxmox.com/docs/backup-client.html#restoring-data
Error: Unable to open dynamic index "/mydatastore/vm/104/2021-02-23T13:45:03Z/catalog.pcat1.didx" - No such file or directory (os error 2)

2) https://bugzilla.proxmox.com/show_bug.cgi?id=2854
no qemu-nbd binary, no packages found matching pve-qemu-kvm

3) https://community.nethserver.org/t/howto-restore-a-single-file-from-proxmox-backup-server-pbs/17302
no guestmount binary, using "normal" mount get:
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.

Is there a proper way or do I have to wait for the bugzilla ticket to be resolved/implemented?


Lars
 
I understand that it is possible to restore a single file from a backup when using the proxmox-backup-client but not when using PVE/PBS, is that correct?
No that is not correct, you can restore those for host backups as well as VM/CT backups.

Note that you have to differentiate between host/CT backups and VM backups, as they are handled differently.
Tried the following ways and had the following problems:
1) https://pbs.proxmox.com/docs/backup-client.html#restoring-data
Error: Unable to open dynamic index "/mydatastore/vm/104/2021-02-23T13:45:03Z/catalog.pcat1.didx" - No such file or directory (os error 2)
Could you please post the exact command you are trying to execute, not just the error message?

I assume this is a VM backup, not a CT one, so this will not work... You will have to use map and mount instead, see https://forum.proxmox.com/threads/unable-to-mount-backup.79566/#post-352495
 
Last edited:
Hello,

I understand that it is possible to restore a single file from a backup when using the proxmox-backup-client but not when using PVE/PBS, is that correct?

Tried the following ways and had the following problems:
1) https://pbs.proxmox.com/docs/backup-client.html#restoring-data
Error: Unable to open dynamic index "/mydatastore/vm/104/2021-02-23T13:45:03Z/catalog.pcat1.didx" - No such file or directory (os error 2)

2) https://bugzilla.proxmox.com/show_bug.cgi?id=2854
no qemu-nbd binary, no packages found matching pve-qemu-kvm

3) https://community.nethserver.org/t/howto-restore-a-single-file-from-proxmox-backup-server-pbs/17302
no guestmount binary, using "normal" mount get:
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.

Is there a proper way or do I have to wait for the bugzilla ticket to be resolved/implemented?


Lars
i don't think the .didx should be included in the file name, perhaps try leaving that out
 
i don't think the .didx should be included in the file name, perhaps try leaving that out
It seems more that OP tried to access the catalog for a VM backup. BUT VM backups don't have a catalog file since they are not backed up at file level but rather on block level (unless backed up by running the proxmox-backup-client inside the VM).
 
Could you please post the exact command you are trying to execute, not just the error message?
Code:
proxmox-backup-client catalog dump vm/104/2021-02-23T13:45:03Z --repository root@pam@localhost:8007:mydatastore

I assume this is a VM backup, not a CT one, so this will not work... You will have to use map and mount instead, see https://forum.proxmox.com/threads/unable-to-mount-backup.79566/#post-352495
You're correct. The documentation seems to be missing that part.

I was able to get this working (had to install ntfs-3g):
Code:
proxmox-backup-client list --repository localhost:mydatastore
proxmox-backup-client map vm/103/2021-02-25T09:33:02Z drive-ide0.img --repository localhost:testdatastore
mount -t ntfs -o ro /dev/loop0p1 /mnt

I have also installed PBS in a test VM (just for testing, I know this is not recommended), where this failed. Doesn't really matter, as I won't be using it any further, but if you have a solution for this, it might help others.
Code:
#proxmox-backup-client map vm/104/2021-02-23T14:02:03Z drive-scsi0.img --repository localhost:mydatastore
Error: loop-control GET_FREE failed - No such file or directory (os error 2)
 
Last edited:
  • Like
Reactions: che
Code:
proxmox-backup-client catalog dump vm/104/2021-02-23T13:45:03Z --repository root@pam@localhost:8007:mydatastore


You're correct. The documentation seems to be missing that part.

I was able to get this working (had to install ntfs-3g):
Code:
proxmox-backup-client list --repository localhost:mydatastore
proxmox-backup-client map vm/103/2021-02-25T09:33:02Z drive-ide0.img --repository localhost:testdatastore
mount -t ntfs -o ro /dev/loop0p1 /mnt

I have also installed PBS in a test VM (just for testing, I know this is not recommended), where this failed. Doesn't really matter, as I won't be using it any further, but if you have a solution for this, it might help others.
Code:
#proxmox-backup-client map vm/104/2021-02-23T14:02:03Z drive-scsi0.img --repository localhost:mydatastore
Error: loop-control GET_FREE failed - No such file or directory (os error 2)
Glad it worked and you were able to get what you wanted.

Regarding the issue inside the VM: I assume this error stems from the code which tries to find the next free loop device during the mapping. However I do not know why this might fail inside the VM.

If you can reproduce this, it might be worth opening a low priority bug report for this here: https://bugzilla.proxmox.com/

EDIT: Could you check if there is a /dev/loop-control in your VM? From the loop man page I suppose that this is how the next free loop device is obtained
Code:
   /dev/loop-control
       Since Linux 3.1, the kernel provides the /dev/loop-control
       device, which permits an application to dynamically find a free
       device, and to add and remove loop devices from the system.  To
       perform these operations, one first opens /dev/loop-control and
       then employs one of the following ioctl(2) operations:

       LOOP_CTL_GET_FREE
              Allocate or find a free loop device for use.  On success,
              the device number is returned as the result of the call.
              This operation takes no argument.
 
Last edited:
There is no such device in my VM. Should I still open a bug report?
Not for now, I would not consider this a PBS bug. And in most cases you would do this on the client and not the PBS host anyway.

It is somehow interesting to me and I don't get why the /dev/loop-control node is not present in your VM.
Does the kernel running in the VM is compiled with the loop module?

Running cat /boot/config-$(uname -r) | grep DEV_LOOP should give you something like
Code:
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_LOOP_MIN_COUNT=8
CONFIG_AUFS_BDEV_LOOP=y

If it is a module (m instead of y in the output), is the kernel module loaded lsmod | grep loop?

Does losetup -l create the device?

Sorry if I bother you with this one, I just find it interesting and learning a bit more about loop devices along the way... ;)
 
Last edited:
Sure, no problem. I understand that =)
Code:
temp-pbs:~# ll /dev/loop*
ls: cannot access '/dev/loop*': No such file or directory
temp-pbs:~#
temp-pbs:~# cat /boot/config-$(uname -r) | grep DEV_LOOP
cat: /boot/config-5.4.98-1-pve: No such file or directory
temp-pbs:~# lsmod | grep loop
temp-pbs:~# losetup -l
temp-pbs:~# ll /dev/loop*
ls: cannot access '/dev/loop*': No such file or directory

I found this and in the CT settings enabled "Options > Features > Create Device Nodes", but no difference in the output above, and "mknod /dev/loop8 b 7 0" threw "Operation not permitted". Looked for systemd-nspawn, but locate didn't found anything.
 
Sure, no problem. I understand that =)
Code:
temp-pbs:~# ll /dev/loop*
ls: cannot access '/dev/loop*': No such file or directory
temp-pbs:~#
temp-pbs:~# cat /boot/config-$(uname -r) | grep DEV_LOOP
cat: /boot/config-5.4.98-1-pve: No such file or directory
temp-pbs:~# lsmod | grep loop
temp-pbs:~# losetup -l
temp-pbs:~# ll /dev/loop*
ls: cannot access '/dev/loop*': No such file or directory

I found this and in the CT settings enabled "Options > Features > Create Device Nodes", but no difference in the output above, and "mknod /dev/loop8 b 7 0" threw "Operation not permitted". Looked for systemd-nspawn, but locate didn't found anything.
Thx for the infos!

Ah I see, you are running in a container, not a virtual machine. Than this is expected behaviour, as these nodes are not accessible from within the container for security reasons.