qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Using the one disk image file on 2 virtual machines at


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] Using the one disk image file on 2 virtual machines at the same time
Date: Wed, 29 Jul 2015 09:46:53 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

On Wed, Jul 29, 2015 at 12:57:30AM +0900, Manjong Han wrote:
> I was facing a weird behavior when I used the one disk image file on 2
> virtual machines at the same time.
> 
> I made the instance of a virtual machine, using the below command.
> $ qemu-system-x86_64 -smp 2 -m 1024 -hda 10G.qcow2 -enable-kvm
> 
> When the OS(Ubuntu 14.04 64bit) was booted up, I made an another one, using
> same command.
> $ qemu-system-x86_64 -smp 2 -m 1024 -hda 10G.qcow2 -enable-kvm
> 
> Then, I had 2 virtual machines, using same disk image file.

This configuration is invalid.  It's similar to using the same physical
disk or iSCSI LUN from two machines at the same time.

Standard file systems (ext4, xfs) and volume managers (LVM) are not
cluster-aware by default.  They must only be accessed from one machine
at a time.  Otherwise you risk data corruption.

You should probably use qcow2 backing files instead:

  10G.qcow2 <-- vm001.qcow2
            ^-- vm002.qcow2

The command to create these files is:

  qemu-img create -f qcow2 -o backing_file=10G.qcow2 vm001.qcow2.

Both VMs share the data in 10G.qcow2.  All writes go to vm001.qcow2 or
vm002.qcow2, respectively, so they don't corrupt each other.

Stefan

Attachment: pgpfLZCEjd2sI.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]