Mounting the filesystem from a "lost" VM

Feb 14, 2021
41
2
13
68
Denmark
Yesterday I had serious problems with one of my VMs, and I was forced to recover from a backup. But the data from the VM are still on my disks, running zfs:
Code:
lrwxrwxrwx 1 root root  9 Jan  6 12:55 /dev/rpool/data/vm-100-disk-0 -> ../../zd0
lrwxrwxrwx 1 root root 11 Jan  6 12:55 /dev/rpool/data/vm-100-disk-0-part1 -> ../../zd0p1
lrwxrwxrwx 1 root root 11 Jan  6 12:55 /dev/rpool/data/vm-100-disk-0-part2 -> ../../zd0p2
lrwxrwxrwx 1 root root 10 Jan  5 14:47 /dev/rpool/data/vm-101-disk-0 -> ../../zd16
lrwxrwxrwx 1 root root 12 Jan  5 14:47 /dev/rpool/data/vm-101-disk-0-part1 -> ../../zd16p1
lrwxrwxrwx 1 root root 12 Jan  5 14:47 /dev/rpool/data/vm-101-disk-0-part2 -> ../../zd16p2
lrwxrwxrwx 1 root root 12 Jan  5 14:47 /dev/rpool/data/vm-101-disk-0-part3 -> ../../zd16p3
lrwxrwxrwx 1 root root 10 Jan  5 23:13 /dev/rpool/data/vm-102-disk-0 -> ../../zd32
lrwxrwxrwx 1 root root 12 Jan  5 23:13 /dev/rpool/data/vm-102-disk-0-part1 -> ../../zd32p1
lrwxrwxrwx 1 root root 12 Jan  5 23:13 /dev/rpool/data/vm-102-disk-0-part2 -> ../../zd32p2
vm-100 is the old VM, vm-101 is a small linux server, vm-102 is the VM installed from the backup. I would like to access data from vm-100, e.g. find emails received between the time of the backup and the time of the crash. I've been able to make the disk available as a "loopback":
Code:
# losetup --partscan -f  /dev/rpool/data/vm-100-disk-0
But I can't mount any of the two partitions:
Code:
# mount /dev/loop1p1 /mnt/oldsme/
mount: /mnt/oldsme: wrong fs type, bad option, bad superblock on /dev/loop1p1, missing codepage or helper program, or other error.
# mount /dev/loop1p2 /mnt/oldsme/
mount: /mnt/oldsme: unknown filesystem type 'LVM2_member'.
root@sonja:/mnt/oldsme#
lvmdiskscan recognizes the loopback device:
Code:
lvmdiskscan
  /dev/loop1p1 [     500.00 MiB]
  /dev/loop2   [     500.00 MiB]
  /dev/sda2    [     512.00 MiB]
  /dev/loop1p2 [     511.51 GiB] LVM physical volume
  /dev/loop3   [     511.51 GiB] LVM physical volume
  /dev/sda3    [     931.01 GiB]
  /dev/loop4   [     500.00 MiB]
  /dev/sdb2    [     512.00 MiB]
  /dev/sdb3    [     931.01 GiB]
  /dev/sdc2    [     512.00 MiB]
  /dev/sdc3    [     931.01 GiB]
  /dev/sdd1    [      <1.82 TiB]
  /dev/sde1    [     931.50 GiB]
  0 disks
  11 partitions
  0 LVM physical volume whole disks
  2 LVM physical volumes

I've done a lot of searching, but not to much avail. How can I mount the /dev/loop1p2 device and get access to my data?

Jesper, Denmark
 
Hi,
what does lsblk -o NAME,FSTYPE,PARTUUID /dev/rpool/data/vm-100-disk-0 tell you about the disk?

As some partitions seem to have been used by LVM, can you see the logical volumes that were present in the VM with lvs? If yes, you also should check lsblk -o NAME,FSTYPE,PARTUUID /dev/mapper/<volume group name>-<LV name> and try to mount it if the expected file system is there.
 
Hi Fabian,
Thanks for your reply and suggestions :)

Is the info below of any help?

Code:
# lsblk -o NAME,FSTYPE,PARTUUID /dev/rpool/data/vm-100-disk-0
NAME    FSTYPE      PARTUUID
zd0                 
├─zd0p1 xfs         00098968-01
└─zd0p2 LVM2_member 00098968-02
Code:
# lvs
  WARNING: Not using device /dev/loop3 for PV QMDM28-I27e-cv9f-e2Pd-FGpQ-rgIR-gZh8CD.
  WARNING: PV QMDM28-I27e-cv9f-e2Pd-FGpQ-rgIR-gZh8CD prefers device /dev/loop1p2 because device was seen first.
  LV   VG   Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root main -wi-a----- <503.63g                                                   
  swap main -wi-a-----   <7.88g
Code:
# lsblk -o NAME,FSTYPE,PARTUUID /dev/mapper/main-root
NAME      FSTYPE PARTUUID
main-root xfs

Best regards,
Jesper, Denmark
 
So the VM had an xfs partition and an LVM with another xfs volume (and swap) inside? If that sounds correct, I'd suggest trying to mount them
Code:
mount -t xfs /dev/mapper/main-root <mount point>
mount -t xfs /dev/zd0p1 <other mount point>
 
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!