Mount device zd16 zd16p1 zd16p2 type LVM en Proxmox 6?

POL CRIOLLO

New Member
Feb 4, 2020
17
0
1
49
My greetings.

I commented that by mistake a node was added to the cluster, the virtual machines that were functioning normally in the proxmox node were lost.

Here we can see that the disks are in storage, the necessary machines are 100, 101 and 102, these files indicate that they are in raw format.

How can I use those raw files to perform the restoration process.

1580881747020.png

Use command.

oot@two:/# pvesm list local-zfs
local-zfs:vm-100-disk-0 raw 536870912000 100
local-zfs:vm-101-disk-0 raw 536870912000 101
local-zfs:vm-102-disk-0 raw 536870912000 102
local-zfs:vm-2001-disk-0 raw 536870912000 2001
local-zfs:vm-2002-disk-0 raw 536870912000 2002
local-zfs:vm-2003-disk-0 raw 536870912000 2003
local-zfs:vm-2004-disk-0 raw 536870912000 2004
root@two:/#
We check with these commands that raw disks are represented by zd16 devices and their zd16p1 and zd16p2 partitions

root@two:/# pvesm path local-zfs:vm-102-disk-0
/dev/zvol/rpool/data/vm-102-disk-0
root@two:/# ls -l /dev/zvol/rpool/data/vm-102-disk-0
lrwxrwxrwx 1 root root 13 Feb 4 07:17 /dev/zvol/rpool/data/vm-102-disk-0 -> ../../../zd16
root@two:/# ls -l /dev/zd16
brw-rw---- 1 root disk 230, 16 Feb 4 07:17 /dev/zd16
root@two:/# ls -l /dev/zd16p1
brw-rw---- 1 root disk 230, 17 Feb 4 07:17 /dev/zd16p1
root@two:/# ls -l /dev/zd16p2
brw-rw---- 1 root disk 230, 18 Feb 4 07:17 /dev/zd16p2

If I mount the windows disk partitions, without problem I can see all the files.

The problem is when the disk partition that is Linux LVM is mounted, you cannot see the files


root@two:/dev# mount /dev/zd16p2 /disk0
mount: /disk0: unknown filesystem type 'LVM2_member'.
root@two:/dev#
I am interested in copying the files and directories of that partition.

What suggestions can you give me.

Thank you.

Paul C.
 
First of all make sure you have a backup of the data - since accessing it can always lead to unforseen problems and thus dataloss!

root@two:/dev# mount /dev/zd16p2 /disk0
mount: /disk0: unknown filesystem type 'LVM2_member'.
This says that partition 2 of /dev/zd16 (/dev/zd16p2) is part of a LVM Volume group...

You have 2 possibilities to get access to the disks:
A)
* create a VM with the fitting VM-id (100, 102, 102,...) - run `qm rescan --vmid 100` - the disks should show up as `unused0` in the GUI
* replace the disk you created with the VM with the one you want to access
* start the VM
* this should give you the system back as it was
* optionally boot the system from a linux live cd - and use the recovery tools there

- This assumes that you have the local-zfs storage configured in the PVE node

B) try to import the VG on the node directly and access the data on the correct LV on that VG:
* PVE excludes some blockdevices from scanning for LVM VGs (in order to prevent to have all guests' VGs being accessible on the PVE node, which leads to problems with the LVM utilities and potential dataloss)
* remove one of the zvols (e.g. /dev/zd16)in question from the global_filter in '/etc/lvm/lvm.conf ' (the comments around the option global_filter explain quite well how to add one device while keeping the filter otherwise intact AFAIR)
* run `pvs` and `vgs` - the zvol should show up with a volume group
* try mounting the LV where the data is (it depends on the linux installation how this would be called - check the output of `lvs` to find out which one it is
* rescue the data from the mounted LV
* umount the LV, deactivate the VG (see `man vgchange`)
* repeat the steps with the next zvol

* finally restore the global_filter setting to its original value

I hope this helps!
 

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!