-1

I am using mount/umount commands with a Win VM on a KVM Linux host. I have a script that continuously loops:

sleep 1 sec
mount
read guest file
unmount

When I change a Win7 file (say, a text file using Notepad),I am able to see changes only after 10-30 seconds.
I also tried Windows 7 VM file cache flushing, but still there is no improvement in the performance.
Is there a way to force Windows 7 machine to write file changes directly on hard drive instead of cache?

Reference link:
Share files between Linux host and Windows guest

4
  • What exactly are you mounting? Some kind of shared/cluster filesystem? Commented Feb 10, 2015 at 4:29
  • I am mounting "raw" disk image of Win7 VM. Commented Feb 10, 2015 at 16:06
  • What kind of filesystem is it, though? Because if it's not a cluster filesystem like OCFS2, you can only mount it outside the VM while the VM is not running, but from the question it sounds like this is being done while the VM is running. Commented Feb 11, 2015 at 3:17
  • It is NTFS file system. Commented Feb 12, 2015 at 21:27

2 Answers 2

0

most probably the sync command in your script would help. It will degrade overall performance of Linux box at the moment it is called, because it will flush all file caches to disk. It will not remove data from caches, just physically writes to disk.

1
  • I tried 'sync' command on Linux host side, but it did not help. Then I found sync.exe which is Win utility. link: technet.microsoft.com/en-us/sysinternals/bb897438.aspx . I tried it and it is able to flush all file cache to disk. So after changing my file, if I do sync on Win7 guest side, I am able to see changes immediately (less than 0.5 sec) on the host side. I'm currently making measurements to get the exact latency. If anyone would like to see the host script I'm using, please let me know. Commented Feb 10, 2015 at 21:52
0

As per the clarifications you gave in comments, you are trying to mount an NTFS filesystem on two systems at the same time. In this case, the filesystem in question is the root filesystem of a VM and, while the VM is still running, you are trying to mount the filesystem from outside the VM. That cannot be done safely. You will corrupt the filesystem and lose data.

There are filesystems like OCFS2 that are designed for mounting shared storage devices on multiple systems simultaneously. They rely on communication between the mounting nodes to coordinate the on-disk state of the filesystem at all times.

"Normal" filesystems like NTFS do not support this. The filesystem must only be mounted on one system at a time. The state of the filesystem on disk is not necessarily consistent at all times while it is mounted. Operations are in the middle of taking place, buffers are cached in RAM, etc... They are simply not designed to coordinate simultaneous on-disk operations between multiple mounting nodes.

2
  • I'm working with Harshal. We're only doing read from the host side, no writes. It works reliably, no corruption, and we can get about 8 MByte/sec data transfer rate. Making repeated unmount and mount calls is inefficient, so now the objective is to find a method with less overhead. Commented Feb 14, 2015 at 2:17
  • @JeffBrower, it doesn't matter if you're doing only reads, although of course the problem would be much more serious if you were also doing writes. It's just not something that a non-cluster filesystem can support except by sheer luck. I really encourage you to find another method of data transfer. Commented Feb 14, 2015 at 8:45

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.