<div dir="ltr"><div dir="ltr">Thank you for the clarification. <br></div><div dir="ltr"><br></div><div>Regards,</div><div>Bharath</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 7, 2019 at 10:16 PM Daniel P. Berrangé <<a href="mailto:berrange@redhat.com">berrange@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, Aug 07, 2019 at 09:57:02PM +0530, bharath paulraj wrote:<br>
> Hi Team,<br>
> <br>
> I am doing a small testing and I don't know if my expectation is correct or<br>
> not. Pardon me if I am ignorant.<br>
> I created a VM and the VM is running. In the hypervisor I have created<br>
> ".img" file and attached this .img file to the VM.<br>
> My expectation is that, if VM is writing files to the attached disk, then<br>
> it should reflect in the .img file created in the hypervisor. But It is not<br>
> working as my expectation.<br>
> Please correct me if my expectation is wrong.<br>
> <br>
> Steps:<br>
> 1. Created disk.img in the hypervisor using the command: dd if=/dev/zero<br>
> of=disk.img bs=1M count=50; mkfs ext3 -F disk.img<br>
> 2. Attached the disk to the running VM using the command: virsh attach-disk<br>
> <Domain-Name> --source disk.img  --target vdb --live<br>
> 3. In the VM, I mounted the disk and created few files.<br>
> 4. In the hypervisor, I mounted the disk.img to check if the file created<br>
> in the VM exists in the .img file.<br>
>    >> I am not able to see those files.<br>
<br>
Do *NOT* do step 4 - it is incredibly dangerous in general and may well<br>
result in filesystem corruption & serious data loss.<br>
<br>
Most filesystems are only designed to be used by a single OS at any time.<br>
<br>
By mounting it on the host, you have 2 separate OS both accessing the<br>
same filesystem.  Even if you mount a filesystem with the read-only<br>
flag, there can still be writes to the filesystem as the second OS to<br>
mount will see it "dirty" and try to replay the journal that reflects<br>
what the first OS was doing.<br>
<br>
Assuming you didn't actually corrupt your FS image, the likely reason<br>
you don't see the file from the host is that the guest OS probably hasn't<br>
flushed it out to disk yet - it'll still be cached in memory in the guest<br>
unless something explicitly ran 'sync'. <br>
<br>
Regards,<br>
Daniel<br>
-- <br>
|: <a href="https://berrange.com" rel="noreferrer" target="_blank">https://berrange.com</a>      -o-    <a href="https://www.flickr.com/photos/dberrange" rel="noreferrer" target="_blank">https://www.flickr.com/photos/dberrange</a> :|<br>
|: <a href="https://libvirt.org" rel="noreferrer" target="_blank">https://libvirt.org</a>         -o-            <a href="https://fstop138.berrange.com" rel="noreferrer" target="_blank">https://fstop138.berrange.com</a> :|<br>
|: <a href="https://entangle-photo.org" rel="noreferrer" target="_blank">https://entangle-photo.org</a>    -o-    <a href="https://www.instagram.com/dberrange" rel="noreferrer" target="_blank">https://www.instagram.com/dberrange</a> :|<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">Regards,<div>Bharath</div></div></div></div>