I have my code on a host and I want it to be run on a Debian virtual machine (that is hosted on that same host).

So I use VmWare's sharing folder to share my code in the virtual machine. But my program is slower than when the code is actually on the VM's harddisk. (probably because of the different filesystem (hgfs vs ext4)

I see two possible solutions :

  • Sync the shared folder to another folder on the VM. So there would no network access. But I don't know which tool I should use. Probably something like a constant one-way rsync, that would also delete the files.

  • Use some kind of "link" like a symbolic link or physical link that would replicate the folder, but I don't know if something like this exists.

How would you do that ?

(Of course, if I have the code on the virtual machine and share it with Samba, the problem is the same and it is slower to access to the files with my IDE)

  • FWIW, if you access the files directly from the host via a network share, it will be slower than if they were on the VM's local disk, but it probably would be faster than using shared folders. – jamesdlin Aug 9 '17 at 23:46

The rsync is a good idea, however you must always make changes on the same host, the one the rsync will grab the source from. You would need some basic bash scripts that runs rsync in a loop with --delete option that removes files from the TARGET that are not present in the SOURCE. Run that script in a screen during startup and you're good to go

Another idea is to use some kind of cloud sync, either like Dropbox, or to spool your own owncloud/nextcloud server to do it.

And if it's really the code that you're trying to sync, the PROPER industry standard is to use git repository, you can create free one in https://bitbucket.org and set both machines to use it, then commit / pull changes whenever needed.

  • I would like to avoid running rsync in a loop because it may not be very efficient. Also, I constantly make modification to the code so this occur before pushing it. – Yohan D Aug 9 '17 at 10:12
  • of course this answer isn't 100% accurate, you can actually set up two way rsync, but it's more complicated and we didn't discuss it before, the author suggested a one way sync solution – bocian85 Aug 9 '17 at 10:13
  • actually one way sync is pretty efficient - when there are not many changes the sync goes pretty fast even with complicated directory structures, and if you would choose that path, i suggest inserting a sleep 10 or something like that in the loop – bocian85 Aug 9 '17 at 10:14
  • 2
    You could use lsyncd in the VM to rsync files to the host (or vice versa if the host is Linux), which should be pretty efficient. – jamesdlin Aug 9 '17 at 23:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.