qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: 한만종 <aksmj8855@gmail.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Using the one disk image file on 2 virtual machines at the same time
Date: Tue, 28 Jul 2015 15:40:23 -0600	[thread overview]
Message-ID: <55B7F6C7.501@redhat.com> (raw)
In-Reply-To: <4A7D0474-7DAE-47F3-8ABA-8EE21036BA20@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1610 bytes --]

On 07/28/2015 11:06 AM, 한만종 wrote:
> Hi,
> 
> I'm 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 the same command.
> $ qemu-system-x86_64 -smp 2 -m 1024 -hda 10G.qcow2 -enable-kvm
> 
> Then, I had 2 virtual machines using the same disk image file.

Bad idea.  You should NEVER have more than one qemu or qemu-img opening
an image read-write at the same time (even having multiple read-only
qemu-img visitors visiting a file opened read-write by qemu is
dangerous).  You are very likely to cause fatal corruption to the point
that neither guest will be able to see data.

> 
> When I made a directory on first virtual machine, using the command like below.
> $ mkdir test1
> 
> The "test1" directory wasn't showed on another virtual machine. And, I made a directory on second virtual machine, using the command like below.
> $ mkdir test2
> 
> The "test2" directory wasn't showed on another virtual machine, either.

And you should NOT expect it to work.  qcow2 images are NOT shared file
systems.  If you want a shared file system, then do something like
having both your guests mount common storage via NFS or glusterfs or
some other protocol designed to be used as a shared file systems.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2015-07-28 21:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-28 17:06 [Qemu-devel] Using the one disk image file on 2 virtual machines at the same time 한만종
2015-07-28 21:40 ` Eric Blake [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-07-28 16:45 Manjong Han
2015-07-28 15:57 Manjong Han
2015-07-29  8:46 ` Stefan Hajnoczi
2015-07-29 11:34   ` Kashyap Chamarthy
2015-07-29 17:29   ` Manjong Han
2015-07-29 17:46     ` John Snow
2015-07-31 12:27       ` Christopher Covington

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55B7F6C7.501@redhat.com \
    --to=eblake@redhat.com \
    --cc=aksmj8855@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).