I'm messing around with KVM and different storage options for sharing between virtual machines. I have an LVM volume group defined as a storage pool for libvirt. I've defined a volume and attached it to two test VMs as a virtio disk. Here's virsh dumpxml

<disk type='block' device='disk'>
  <driver name='qemu' type='raw'/>
  <source dev='/dev/kvm_storage/vm_shared'/>
  <target dev='vda' bus='virtio'/>
  <alias name='virtio-disk0'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>

I can read/write files, but they do not stay in sync between the two virtuals unless I unmount then remount. Is this even supported?

  • I built I high availability system, albeit several years ago, using two machines sharing a volume group. Our caveat was that only one machine could import and make active the volume group at a time. Don't recall if the second could be made read only or not. I would suggest one serve via nfs or samba and the other use,mount as client. – bsd Aug 7 '13 at 11:38

You need an clustered file system.

I do not know what filesystem you are using. But with a standard file system this is not possible and has nothing to do KVM or LVM.

An other solution would be to use a network filesystem like nfs or cifs.

| improve this answer | |

You have to use those levels :

On physical Host :

  • KVM level : second disk for VM marked as "Shared storage" in Virt-manager properties (only disk type "raw" is supported. qcow2 is not supported as "shareable" in vm disk edit screen and virt-manager will not allow you to click "apply" when you tick the "shareable" box)

On VMs :

  • level 0 : DLM (like disk logical management I think) # service dlm start ; Linux packages to install
  • level 1 : LVM management
  • level 2 : GFS2 filesystem formatted on your LVM logical volume
| improve this answer | |

A disk used by a vm at the same time.Otherwise,the filesystem on the disk will be damaged! You can use NAS/NFS/SMB etc network filesystem to share files.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.