[libvirt-users] Reg: content of disk is not reflecting in host.

bharath paulraj bharathpaul at gmail.com
Wed Aug 7 16:56:22 UTC 2019


Thank you for the clarification.

Regards,
Bharath

On Wed, Aug 7, 2019 at 10:16 PM Daniel P. Berrangé <berrange at redhat.com>
wrote:

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


-- 
Regards,
Bharath
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20190807/f3c0eca0/attachment.htm>


More information about the libvirt-users mailing list