Speeding up the vagrant shared-folder on a Windows host (UPD. Not everything is so smooth)



For a year and a half, I was tormented with one unpleasant feature of ubuntu under vagrant - a damn slow shared folder. Simple benchmarks showed a drawdown in the performance of I / O operations by almost 2 orders of magnitude, projects in php worked up to 10 times slower than on the native host. So, today I got a little stuck, looked well ... and it turned out that there was a solution, and now I just can not help but share it with someone. The solution is simple, it will seem obvious to someone, someone knew about him from birth (well, or will say so), but I'm sure that not everyone knows about him.

What’s the problem?


By default, vagrant uses the vboxsf file system, which sometimes works extremely slowly (when this "sometimes" happens - I don’t know, it always slowed down for me). You can find out your type of file system using the mount command.



You can replace the file system, but the problem is that the official documentation ... is lying! She says they say yes, sometimes there are problems with the performance of shared folders, in such cases, use nfs and you will be happy. And below the postscript - windows will not work, and do not try.



Do you know what the salt is? Yes, it works on windows, you can’t believe the documentation!

And what to do?

We go here https://github.com/winnfsd/vagrant-winnfsd , read, put, rejoice. For those who are too lazy to read:

  • run in the windows console "vagrant plugin install vagrant-winnfsd"
  • add two lines to vagrantfile

config.vm.network "private_network", type: "dhcp"
config.vm.synced_folder ".", "/ vagrant", type: "nfs"

Reboot vagrant, you're done! I don’t know, maybe there are some pitfalls, maybe someone will not help, but it seems to work fine for me. My configuration: Windows 10 (host) + ubuntu 14.04 (guest). My laravel project has accelerated page rendering from 6.5 seconds to 0.5, which is good news.

PS The post turned out to be short, chaotic, but if he had caught me a year ago - I would be extremely happy.

UPD In the comments they say that it works unstably. After a day of work, I was convinced myself - there are problems with file synchronization. So not everything is as perfect as it seemed at first glance ...

Also popular now: