[SOLVED] VM Harddrive passthrough: VM and host are not in sync

maeries

Active Member
Jul 10, 2015
28
1
41
it may be a bad title, but I don't know how else to describe it.

So I have a Ubuntu Server VM on Proxmox and I want to passthrough some drives (as passing through a directory does nto work afaik). I used
Code:
sudo qm set 105 -scsi2 /dev/sdb1
to do so. I then mounted it in the guest by putting
Code:
/dev/sdb        /mnt/festplatte1        ext4    defaults        0       0
info the fstab and running mount -a. The drive is also mounted on the host.

Now to the part i dont understand. If I create a folder on that drive in the VM, it also appears on the host, but it takes a minute. Is it normal, that it takes so long? And when the host created a folder on that drives it only appears on the host, not on the VM. Why is that? And last, but not least: If the host deleted the folder created by the VM it disappears for the host, but reappears some time later. Also for the VM the folder never disappears.

Is all that behaviour normal? What I want is basically a container bind mount, but for VMs
 
The drive is also mounted on the host.
This is the problem. Most filesystems assume that the drive is not shared between different machines (virtual or physical) at the same time, as most (physical) drives are not designed to be connected to more than one controller/machine (at the same time). They cache information assuming that no one will change the data on the drive behind their backs. Use SMB or NFS is you want to share folders between machines (virtual or otherwise).
Is all that behaviour normal? What I want is basically a container bind mount, but for VMs
EDIT: Look into QEMU 9p or virtio-fs to share a host folder via a virtual PCI devices. Or use SPICE folder sharing via WebDAV.
 
Last edited:
  • Like
Reactions: maeries
Also check your data integrity. You probably already corrupted some data by mounting it in parallel on two OSs.
 
Last edited:
  • Like
Reactions: maeries
This is the problem. Most filesystems assume that the drive is not shared between different machines (virtual or physical) at the same time, as most (physical) drives are not designed to be connected to more than one controller/machine (at the same time).
That was also my first guess, but since none of the like five tutorials I read mentions it, I tought it is fine
EDIT: Look into QEMU 9p or virtio-fs to share a host folder via a virtual PCI devices. Or use SPICE folder sharing via WebDAV.
Do you mean running sudo qm set 105 -virtio2 /dev/sdb1 or are you talking abount something different?
 
yeah, just ran fsck on the drive
That might be a good indicator, but it can't tell you if your actual data got corrupted. Without a checksumming filesystem like ZFS you would need to compare file checksums against the file checksums of a known good backup.

Do you mean running sudo qm set 105 -virtio2 /dev/sdb1 or are you talking abount something different?
Completely different.
 
  • Like
Reactions: maeries

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!