Re: Reg: content of disk is not reflecting in host.

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

 



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 :|

_______________________________________________
libvirt-users mailing list
libvirt-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvirt-users



[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux