Unable to mount backup

Brian Read

Well-Known Member
Jan 4, 2017
123
6
58
75
Code:
root@pve:~# proxmox-backup-client mount vm/100/2020-10-16T22:45:02Z pbsbackuplocal /mnt/vnsnap0
Error: unable to get (default) repository
root@pve:~#

From the pve command line.
 
Hi, the error message clearly states that you have no default repository configured. You can either configure the repository using the corresponding environmental variable or pass the repository along using the --repository <repository_url> string.
Also, you are only able to mount container archives/backups, in order to access VM images
Code:
proxmox-backup-client map <snapshot> <archive-name> --repository <repository_url>
is what you are looking for. This will create a local loop device of the VM image.
 
Last edited:
Code:
root@pve:~# proxmox-backup-client map vm/100/2020-10-16T22:45:02Z pbsbackuplocal --repository "root@pam@pveserver.bjsystems.co.uk:pbsbackuplocal"
Password for "root@pam": ********
Error: Can only mount/map pxar archives and drive images.
root@pve:~#

I guess I am still not understanding this!
 
you need to give it the archive name (which backed-up disk you want to map), like so
Code:
$ proxmox-backup-client map vm/123/2020-11-11T14:16:36Z drive-scsi0.img --repository test@pbs@localhost:backuptest
Password for "test@pbs": ******
Image 'test@pbs@localhost:8007:backuptest:vm/123/2020-11-11T14:16:36Z/drive-scsi0.img' mapped on /dev/loop0

and then you can access the data (read-only) via /dev/loop0
 
Progress! Now i've got the image mapped, how can I access it from the command line?

I've tried mount:

Code:
root@pve:~# proxmox-backup-client map vm/100/2020-10-16T22:45:02Z drive-virtio0.img --repository "root@pam@192.168.100.98:pbsbackuplocal"
Password for "root@pam": ********
Image 'root@pam@192.168.100.98:8007:pbsbackuplocal:vm/100/2020-10-16T22:45:02Z/drive-virtio0.img' mapped on /dev/loop0

root@pve:~# mount /dev/loop0 /mnt/vzsnap0
mount: /mnt/vzsnap0: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.
r
 
Progress! Now i've got the image mapped, how can I access it from the command line?

I've tried mount:

Code:
root@pve:~# proxmox-backup-client map vm/100/2020-10-16T22:45:02Z drive-virtio0.img --repository "root@pam@192.168.100.98:pbsbackuplocal"
Password for "root@pam": ********
Image 'root@pam@192.168.100.98:8007:pbsbackuplocal:vm/100/2020-10-16T22:45:02Z/drive-virtio0.img' mapped on /dev/loop0

root@pve:~# mount /dev/loop0 /mnt/vzsnap0
mount: /mnt/vzsnap0: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.
r
You are almost there... So the VM image will have partitions on them, so what you want is to mount the filesystem present on the partition, not the block device. The map command should create a loop device for each partition. Let me show by an example, I have the following VM backup:
Code:
# proxmox-backup-client list --repository local:store
┌───────────────┬────────────────────────────────────┬──────────────┬────────────────────────────────────────────────────────────────┐
│ group         │ last snapshot                      │ backup-count │ files                                                          │
╞═══════════════╪════════════════════════════════════╪══════════════╪════════════════════════════════════════════════════════════════╡
│ vm/102        │ vm/102/2020-11-25T11:00:44Z        │            6 │ client.log drive-scsi0.img fw.conf index.json qemu-server.conf │
└───────────────┴────────────────────────────────────┴──────────────┴────────────────────────────────────────────────────────────────┘
# proxmox-backup-client map vm/102/2020-11-25T11:00:44Z drive-scsi0.img --repository local:store
Image 'local:store:vm/102/2020-11-25T11:00:44Z/drive-scsi0.img' mapped on /dev/loop0
# ls /dev/loop0*
/dev/loop0  /dev/loop0p1
# mount -t ext4 -o ro /dev/loop0p1 /mnt/mountpoint
# ls /mnt/mountpoint
bin  boot  dev  etc  home  lib  lib64  lost+found  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
Note that the host must have support for the filesystem of the partition of the vm backup in order for this to work.
 
Last edited:
Code:
root@pve:~# ls /dev/loop0*
/dev/loop0  /dev/loop0p1  /dev/loop0p2
root@pve:~# mount /dev/loop0p2 /mnt/vzsnap0
mount: /mnt/vzsnap0: unknown filesystem type 'LVM2_member'.
root@pve:~# mount -t ext4 /dev/loop0p2 /mnt/vzsnap0
mount: /mnt/vzsnap0: wrong fs type, bad option, bad superblock on /dev/loop0p2, missing codepage or helper program, or other error.
root@pve:~# mount /dev/loop0p1 /mnt/vzsnap0
mount: /mnt/vzsnap0: unknown filesystem type 'linux_raid_member'.
root@pve:~#

So this the next issue!
 
It seems you have a software RAID configured for the VM, so depending on what RAID your are using, several disks might be needed to mount the filesystem. You can check the RAID level with mdadm --examine /dev/loop0 and follow this procedure in order to try to mount https://serverfault.com/questions/383362/mount-unknown-filesystem-type-linux-raid-member/383373
Is there a reason why you use a RAID in the VM? To me it seems more reasonable to have redundancy on the host, not the VM level.
 
Thanks for your help.

The VM is a server running in a degraded raid mode (only one disc). It is an smeserver based on Centos 6 (yes I know it is EOL) and the installation when done did not give the option for a non raid install (or at least I did not find it!).

Just looked at your link. Phew! not sure I want to create an mdadm raind array for it on the pve, sounds very dangerous. This is my main server and quite precious to me!

Code:
root@pve:~# mdadm /dev/loop0
/dev/loop0: is not an md array
root@pve:~# mdadm /dev/loop0p1
/dev/loop0p1: is not an md array
/dev/loop0p1: device 0 in 2 device inactive raid1 array.  Use mdadm --examine for more detail.
root@pve:~# mdadm /dev/loop0p2
/dev/loop0p2: is not an md array
root@pve:~#
 
Thanks for your help.

The VM is a server running in a degraded raid mode (only one disc). It is an smeserver based on Centos 6 (yes I know it is EOL) and the installation when done did not give the option for a non raid install (or at least I did not find it!).

Just looked at your link. Phew! not sure I want to create an mdadm raind array for it on the pve, sounds very dangerous. This is my main server and quite precious to me!

Code:
root@pve:~# mdadm /dev/loop0
/dev/loop0: is not an md array
root@pve:~# mdadm /dev/loop0p1
/dev/loop0p1: is not an md array
/dev/loop0p1: device 0 in 2 device inactive raid1 array.  Use mdadm --examine for more detail.
root@pve:~# mdadm /dev/loop0p2
/dev/loop0p2: is not an md array
root@pve:~#
You are missing the --examine flag... The thing is that you are operating on a backup in readonly mode, so from that point of view you are safe.
Anyway, is it not way easier in your case to do a restore of the VM an copy whatever data you need by ssh or some other means? I mean mounting the raid array should work, but let's be pragmatic! :)
 
Code:
root@pve:~# mdadm --examine /dev/loop0
/dev/loop0:
   MBR Magic : aa55
Partition[0] :       512000 sectors at         2048 (type fd)
Partition[1] :   3774359552 sectors at       514048 (type 8e)
root@pve:~#

I am all for pragmatism, but this VM has 1.5Tb of data! and thus I cannot easily restore it for time and space reasons.
 
you can also boot a VM from the loop device (use it as disk like any other passthrough disk, append 'snapshot=1' to make it in-memory writable (any changes will be thrown away when you power down the VM, and not written back to the disk which in this case would be impossible anyway). that way, all the actual access/LVM/MD stuff happens in the VM with all the usual isolation from your host. data is still only read on-demand from the PBS system, so no need to transfer all the 1.5TB (unless you do something that scans the whole disk, obviously)
 
  • Like
Reactions: che
ok, So I've re-worked that VM (and updated it to Centos 7), it is now Ext4:

Code:
root@pve:~# proxmox-backup-client map vm/103/2021-02-19T16:27:42Z drive-scsi0.img --repository "root@pam@192.168.100.98:pbsbackuplocal"
Password for "root@pam": ********
Image 'root@pam@192.168.100.98:8007:pbsbackuplocal:vm/103/2021-02-19T16:27:42Z/drive-scsi0.img' mapped on /dev/loop0

Disk /dev/loop0: 500 GiB, 536870912000 bytes, 1048576000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0001a1f8

Device       Boot      Start        End    Sectors  Size Id Type
/dev/loop0p1 *          2048 1027606527 1027604480  490G 83 Linux
/dev/loop0p2      1027606528 1035995135    8388608    4G 82 Linux swap / Solaris

root@pve:~# mkdir -p /mnt/mountpoint
root@pve:~# mount -t ext4 -o ro /dev/loop0p1 /mnt/mountpoint
mount: /mnt/mountpoint: cannot mount /dev/loop0p1 read-only.

As you can see it still won't mount it.
 
ok, So I've re-worked that VM (and updated it to Centos 7), it is now Ext4:

Code:
root@pve:~# proxmox-backup-client map vm/103/2021-02-19T16:27:42Z drive-scsi0.img --repository "root@pam@192.168.100.98:pbsbackuplocal"
Password for "root@pam": ********
Image 'root@pam@192.168.100.98:8007:pbsbackuplocal:vm/103/2021-02-19T16:27:42Z/drive-scsi0.img' mapped on /dev/loop0

Disk /dev/loop0: 500 GiB, 536870912000 bytes, 1048576000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0001a1f8

Device       Boot      Start        End    Sectors  Size Id Type
/dev/loop0p1 *          2048 1027606527 1027604480  490G 83 Linux
/dev/loop0p2      1027606528 1035995135    8388608    4G 82 Linux swap / Solaris

root@pve:~# mkdir -p /mnt/mountpoint
root@pve:~# mount -t ext4 -o ro /dev/loop0p1 /mnt/mountpoint
mount: /mnt/mountpoint: cannot mount /dev/loop0p1 read-only.

As you can see it still won't mount it.
perhaps your filesystem has a dirty log, try with norecovery
mount -t ext4 -o ro,norecovery /dev/loop0p1 /mnt/mountpoint
 
  • Like
Reactions: che

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!