[SOLVED] Howto mount omv-drive directly on proxmox host

jofland

New Member
Oct 26, 2023
17
2
3
I have omv running as an vm in proxmox. I have assigned a lvm volume as iscsi to omv and formated the disk as ext4 in omv.

Now I want to mount this lvm volume dirctly on the proxmox host, but i get the following error:
Code:
root@pve01:~# mount /dev/localdata/vm-106-disk-0 /mnt
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/mapper/localdata-vm--106--disk--0, missing codepage or helper program, or other error.
       dmesg(1) may have more information after failed mount system call.

==> How can I mount this drive for backup purposes?

Additional infos:
Code:
root@pve01:~# lsblk
NAME                                                   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
nvme0n1                                                259:0    0   3.7T  0 disk
├─nvme0n1p1                                            259:1    0  1007K  0 part
├─nvme0n1p2                                            259:2    0     1G  0 part /boot/efi
├─nvme0n1p3                                            259:3    0 475.9G  0 part
│ ├─pve-swap                                           253:0    0     8G  0 lvm  [SWAP]
│ ├─pve-root                                           253:1    0    96G  0 lvm  /
│ ├─pve-data_tmeta                                     253:5    0   3.6G  0 lvm
│ │ └─pve-data-tpool                                   253:7    0 348.8G  0 lvm
│ │   ├─pve-data                                       253:8    0 348.8G  1 lvm
│ │   ├─pve-vm--100--disk--0                           253:9    0     4G  0 lvm
...
│ │   └─pve-vm--110--disk--1                           253:25   0    32G  0 lvm
│ └─pve-data_tdata                                     253:6    0 348.8G  0 lvm
│   └─pve-data-tpool                                   253:7    0 348.8G  0 lvm
│     ├─pve-data                                       253:8    0 348.8G  1 lvm
│     ├─pve-vm--100--disk--0                           253:9    0     4G  0 lvm
---
│     └─pve-vm--110--disk--1                           253:25   0    32G  0 lvm
└─nvme0n1p4                                            259:4    0   3.3T  0 part
  ├─localdata-vm--106--disk--0                         253:2    0   600G  0 lvm
  ├─localdata-vm--106--disk--1                         253:3    0   500G  0 lvm
  └─localdata-vm--106--disk--2                         253:4    0   750G  0 lvm

Code:
root@pve01:~# vgdisplay
  --- Volume group ---
  VG Name               localdata
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               3.26 TiB
  PE Size               4.00 MiB
  Total PE              854657
  Alloc PE / Size       473600 / <1.81 TiB
  Free  PE / Size       381057 / 1.45 TiB
  VG UUID               zVksrS-A0j3-Q3FE-Xh....

  --- Volume group ---
  VG Name               pve
....


Code:
root@pve01:~# lvdisplay /dev/localdata/vm-106-disk-0
  --- Logical volume ---
  LV Path                /dev/localdata/vm-106-disk-0
  LV Name                vm-106-disk-0
  VG Name                localdata
  LV UUID                jDuZfA-TkI....
  LV Write Access        read/write
  LV Creation host, time pve01, 2023-10-27 19:39:12 +0200
  LV Status              available
  # open                 1
  LV Size                600.00 GiB
  Current LE             153600
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2
 
Maybe the virtual disk is partitioned inside the VM and you need an offset from the beginning of the disk to mount the partition with the Ext4?
Please note that Ext4 is not designed to work on two systems at once. Writing to it while the VM is running is a sure way to lose data and reading it might give you incomplete data (because of caching inside the VM). Proxmox has various ways to backup a VM that (try to) take all of this into account.
 
OK. How do I find out the offset?

I only want to access this partition (vm-disk) in an emergency case if the omv vm does not work anymore in the future. I want to have an easy end reliable way to access my data if ovm or proxmox fails. Now I want to test this way before I put my data on the omv disk.
 
fdisk shows the offset of 2048 bytes for partition1 within the lv:

Code:
root@pve01:~# fdisk -l /dev/localdata/vm-106-disk-0
Disk /dev/localdata/vm-106-disk-0: 600 GiB, 644245094400 bytes, 1258291200 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: gpt
Disk identifier: C34B53FB-DD8C-40BA-A1B8-4176CD9BD26A

Device                         Start        End    Sectors  Size Type
/dev/localdata/vm-106-disk-0p1  2048 1258291166 1258289119  600G Linux filesystem

But mounting did not work:

Code:
root@pve01:~# mount --read-only -o offset==$((512*2048)) /dev/localdata/vm-106-disk-0 /mnt
mount: /mnt: failed to parse mount options 'ro,offset==1048576': Invalid argument.
 
fdisk shows the offset of 2048 bytes for partition1 within the lv:

Code:
root@pve01:~# fdisk -l /dev/localdata/vm-106-disk-0
Disk /dev/localdata/vm-106-disk-0: 600 GiB, 644245094400 bytes, 1258291200 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: gpt
Disk identifier: C34B53FB-DD8C-40BA-A1B8-4176CD9BD26A

Device                         Start        End    Sectors  Size Type
/dev/localdata/vm-106-disk-0p1  2048 1258291166 1258289119  600G Linux filesystem
Please use gdisk instead of fdisk for drives with a GPT, but that does not matter in this case.
But mounting did not work:

Code:
root@pve01:~# mount --read-only -o offset==$((512*2048)) /dev/localdata/vm-106-disk-0 /mnt
mount: /mnt: failed to parse mount options 'ro,offset==1048576': Invalid argument.
== looks wrong to me. I would expect a single =. Where did it come from?
 
== looks wrong to me. I would expect a single =. Where did it come from?
Thanks. That is a typo with my my dirty glasses :) .

After stopping the omv-vm, I had to activate the vg first:
Code:
vgscan
vgchange -ay localdata

But does not work when mounting read-only:
Code:
root@pve01:~# mount --read-only -o offset=$((512*2048)) /dev/localdata/vm-106-disk-0 /mnt
mount: /mnt: cannot mount /dev/loop0 read-only.
       dmesg(1) may have more information after failed mount system call.

dmesg:
Code:
[ 2621.324240] loop0: detected capacity change from 0 to 1258289152
[ 2621.333297] EXT4-fs (loop0): INFO: recovery required on readonly filesystem
[ 2621.333299] EXT4-fs (loop0): write access unavailable, cannot proceed (try mounting with noload)

When mounting not read-only, mount works:
Code:
root@pve01:~# mount -o offset=$((512*2048)) /dev/localdata/vm-106-disk-0 /mnt
root@pve01:~# ls /mnt/
aquota.group  aquota.user  backup  lost+found

Although, I wonder why read-only mount is not working. it is ok now for me.
 
But does not work when mounting read-only:
Code:
root@pve01:~# mount --read-only -o offset=$((512*2048)) /dev/localdata/vm-106-disk-0 /mnt
mount: /mnt: cannot mount /dev/loop0 read-only.
       dmesg(1) may have more information after failed mount system call.

dmesg:
Code:
[ 2621.324240] loop0: detected capacity change from 0 to 1258289152
[ 2621.333297] EXT4-fs (loop0): INFO: recovery required on readonly filesystem
[ 2621.333299] EXT4-fs (loop0): write access unavailable, cannot proceed (try mounting with noload)

When mounting not read-only, mount works:
Code:
root@pve01:~# mount -o offset=$((512*2048)) /dev/localdata/vm-106-disk-0 /mnt
root@pve01:~# ls /mnt/
aquota.group  aquota.user  backup  lost+found

Although, I wonder why read-only mount is not working. it is ok now for me.
Maybe because there are problems detected on the Ext4 while mounting and those cannot be repaired in read-only?
Did you shutdown the VM properly? Did you enable caching for the virtual disk? Can you do a fsck on the Ext4 inside the VM? Maybe read-only works afterwards.

Please note that there is a Solved option that can be selected when editing the first post of the thread (instead of changing the title).
 
Maybe because there are problems detected on the Ext4 while mounting and those cannot be repaired in read-only?
Did you shutdown the VM properly? Did you enable caching for the virtual disk? Can you do a fsck on the Ext4 inside the VM? Maybe read-only works afterwards.
Yes, VM is shutdown properly.

Before shutdown, I unmounted the device within the omv VM and did a fsck.ext4 (everything ok). After shutdown same negative result while mounting read-only. Anyway, it is ok for me.
Please note that there is a Solved option that can be selected when editing the first post of the thread (instead of changing the title).
Sorry, did not now this.