1

I have set up KVM on Debian 10 host.

There are 2 virtual machines running.

Virtual machine #1 has OMV inside it.
Virtual machine #2 has plain debian.

Each virtual machine is installed in its own qcow2 image file.
These two machines share one additional storage, which is a RAW storage file. Both machines have this storage marked as "Sharable".

Current problem that i have noticed is that file table is not updating on the fly. I mean if you do something with this storage in one VM, changes will not be seen on the other UNTIL that other VM is rebooted (most likely remount does the same).

If changes are made by both VMs, OMV later starts spitting some SMB related errors.

Rebooting OMV did not update file table, however rebooting debian machine resulted in all data lost.

OMV hosts Samba share.

Has anyone had any experience with shared storage and know how to at least manually refresh the file table without remounting storage?

2 Answers2

1

tl;dr: Have your plain Debian VM (virtual machine #2) mount the Samba share hosted on your OpenMediaVault VM (virtual machine #1). Only connect the raw storage file to virtual machine #1.


Explanation

What you have set up is akin to having one flash drive plugged into two computers at the same time. I've written about this before:

When you mount the file system on the hard drive to somewhere on both computers, each computer does not have any idea that the other is also using the file system. This can lead to serious data corruption because each computer is stepping over the other's toes.

From: How can I make the iSCSI initiator propagate changes?

To rectify this, you need a layer between the storage disk (on the server) and the multiple machines (clients) accessing it that is aware that multiple clients can access the same storage.

Two common ways to set this up are NFS and CIFS (Samba), which are network file systems.

I see that you already have a Samba server set up. All you need to do differently to share the storage is to have your VMs connect to that one Samba server. You should only connect the virtual disk to the Samba server.

You could go a step further and set up a distributed file system, which is a way to pool storage from multiple servers and access them on a single network file system.

Alternatively, it is also possible to share the virtual disk like you were originally trying to do, but you still need a file system that is aware that multiple computers could be modifying data at the same time. This other answer suggests shared-disk file systems, which abstract shared storage at a lower level than network file systems.


Resources

Official Documentation

Tutorials

Above and Beyond: Distributed File Systems

Deltik
  • 19,971
0

Mounting an ext4 file system r/w on two nodes at the same time will not make the content available to both - instead it will corrupt the file system.

Marking the disk shareable in virt-manager just stops the hypervisor from warning you - it happens on the virtual hardware level, not on the file system level.

If you want shared disks (and there are good reasons for that) use GFS or OCF2 (the easiest choice for beginners).

Eugen Rieck
  • 20,637