Locally mounting drive that has been passed-through to VM

shalak

Member
May 9, 2021
44
0
11
38
Hi!

I'm running Proxmox 7.0 on HP Proliant DL380e Gen8. I have RAID-1 and RAID-6 configured on P420. Proxmox in installed on volume from RAID1

I've passed-through the RAID6 volume to a VM via qm set 100 -virtio5 /dev/disk/by-id/scsi-xxxxxxxxxxxxxxxxxxx.

I did a little experiment: I mounted the volume on both proxmox and inside the VM.
- when I added a file in VM it was not visible on Proxmox
- when I added a file in Proxmox it was not visible in OMV
- I unmounted disk in both, mounted it back
- only the file created in VM exists on a drive

I assume, that in general this setup is not recommended, but I'm wondering - how does it behave under the hood? Proxmox was able to see file that it created until I remounted the drive.

Overall I would expect that mounting a drive second time would render a "device busy" error (or something similar), so I wonder - why doesn't it?
 
Last edited:
Overall I would expect that mounting a drive second time would render a "device busy" error (or something similar), so I wonder - why doesn't it?
Because how would it know that the filesystem is busy? A block device can be accessed by multiple clients at once, this is intentional. The filesystem on it keeps track locally (that is, within the kernel) that it doesn't get mounted twice, but the two mounts don't happen locally - one's in a "remote" VM.

This is also exactly the reason why this is a *very bad idea*. I cannot stress enough how bad this is. A filesystem that is not intentionally designed for this use-case will always assume full control over the disk are it resides in. If this invariant is not upheld, you *will* lose data, and you *will* corrupt your drive. Most likely even if you mount it read-only. Only a matter of when, not if.

Use a network share, or some other file-sharing solution...
 
  • Like
Reactions: UdoB and shalak

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!