From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41616) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZL9P2-0001AR-5O for qemu-devel@nongnu.org; Fri, 31 Jul 2015 08:27:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZL9Oy-0003ZQ-Re for qemu-devel@nongnu.org; Fri, 31 Jul 2015 08:27:08 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:38517) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZL9Oy-0003Z9-N8 for qemu-devel@nongnu.org; Fri, 31 Jul 2015 08:27:04 -0400 Message-ID: <55BB6995.7020302@codeaurora.org> Date: Fri, 31 Jul 2015 08:27:01 -0400 From: Christopher Covington MIME-Version: 1.0 References: <20150729084653.GB10617@stefanha-thinkpad.redhat.com> <55B9117E.2030006@redhat.com> In-Reply-To: <55B9117E.2030006@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Using the one disk image file on 2 virtual machines at the same time List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow , Manjong Han , Stefan Hajnoczi Cc: qemu-devel@nongnu.org On 07/29/2015 01:46 PM, John Snow wrote: > > > On 07/29/2015 01:29 PM, Manjong Han wrote: >> Thanks, Stefan. >> >> 2015-07-29 17:46 GMT+09:00 Stefan Hajnoczi : >>> >>> 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. >>> >> >> I tried to create a backing files, using the commands which you told. >> >> $ qemu-img create -f qcow2 -o backing_file=10G.qcow2 vm001.qcow2 >> $ qemu-img create -f qcow2 -o backing_file=10G.qcow2 vm002.qcow2 >> >> And, I used these backing files on each virtual machines. >> But, new files weren't written on original disk image(10G.qcow2).. >> The backing files were working each other. >> >>> 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. >>> >> >> I think that I must probably use a shared file system like NFS.. >> > > Yes, any files written using the backing files like outlined above will > put new files in the overlays (e.g. vm001.qcow2 or vm002.qcow2) and NOT > into the backing file (10G.qcow2) > > this is a safe way to share a base image for an OS, but it's not a > method of accomplishing a concurrent fileshare. > > You'll want to configure an NFS or CIFS share (etc) in the base image > and then allow the multiple VMs to utilize that share. Using a VirtIO-9P based passthrough filesystem on both might produce the same result with less host-side configuration required. http://wiki.qemu.org/Documentation/9psetup Chris -- Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project