Mount LVM on Host

Jan 9, 2012
282
2
18
Hi,

i have installed a second Hard Disk on my Host-System.
For this Disk i created the volume group "Test-VG" on the Host System.
About the Proxmox Webinterface i added a new Storage: Add -> LVM group -> ID: "Test_LVM" -> Volume Group: "Test-VG".
Then i installed a new Hard Disk in my Openmediavault-VM (NAS) -> Bus: "VIRTIO" -> Storage: "Test_LVM".
Now there is a new Logical Volume named "vm-101-disk-1".

Now my Questions:
If i started my VM and go to the Openmediavault Webinterface, there i can see my new Hard Disk. I created a Filesystem (ext4) on it an all works correct. But when i turn off the VM and want to mount the Filesystem of the LV direct on the Host, then it does not work:

mount -t ext4 /dev/Test-VG/vm-101-disk-1 /mnt/test/
mount: wrong fs type, bad option, bad superblock on /dev/mapper/Test--VG-vm--101--disk--1,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so

But when i create the ext4 Filesystem for the LV "vm-101-disk-1" direct on the Host System ("mkfs -t ext4 -q /dev/Test-VG/vm-101-disk-1"), i can mount it on the Host System (of course when the VM is stopped!), or in VM.

Why is it so?


Alex
 
Hi,

i have installed a second Hard Disk on my Host-System.
For this Disk i created the volume group "Test-VG" on the Host System.
About the Proxmox Webinterface i added a new Storage: Add -> LVM group -> ID: "Test_LVM" -> Volume Group: "Test-VG".
Then i installed a new Hard Disk in my Openmediavault-VM (NAS) -> Bus: "VIRTIO" -> Storage: "Test_LVM".
Now there is a new Logical Volume named "vm-101-disk-1".

Now my Questions:
If i started my VM and go to the Openmediavault Webinterface, there i can see my new Hard Disk. I created a Filesystem (ext4) on it an all works correct. But when i turn off the VM and want to mount the Filesystem of the LV direct on the Host, then it does not work:



But when i create the ext4 Filesystem for the LV "vm-101-disk-1" direct on the Host System ("mkfs -t ext4 -q /dev/Test-VG/vm-101-disk-1"), i can mount it on the Host System (of course when the VM is stopped!), or in VM.

Why is it so?


Alex
Hi Alex,
like Dietmar wrote - it's looks that openmediafault wrote an partitiontable on that disk (the normal behavior).
With your "mkfs .." from the host, you have destroyed the disk for the client...

If you use kpartx on the host, you can create devices for the partitions of the VM-disks. This devices are useable for mounting.

Udo
 
Hi,

i don't understand, because when there is a new LV and i make a Filesystem on it on the Host "mkfs ...", i can mount it on the Host and i can mount it in the VM (naturally either/or).

But if i have a new LV and make the Filesystem in the VM, i can only mount it in the VM but not on the Host.



Alex
 
Ok, i think i understand now:

The VM sees the LV as a block device and not as a LV like the Host.
So the VM must first create a partition table to make then a Filesystem.
To mount these Filesystems on the Host i can use "kpartx".
Right?

But why can the VM then identify a Filesystem that was created directly by the host, if no partition is present there!?


Alex
 

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!