Vagrant synced folders aren’t case sensitive

case-sensitivelsyncdvagrantvirtualbox

For our web stack, we are moving from a Windows Server to CentOS. To facilitate development, we're utilizing Vagrant to run CentOS VMs locally. We're using Vagrant's Synced Folders feature to allow devs to use their favorite IDEs on their host machine, but we're finding that one key feature is missing from this setup: file system case sensitivity.

The synced folder inside the VM apparently takes on the properties of the host's file system, so if I'm developing from a Windows machine, or even OSX, the file system isn't case sensitive. This is a big issue, as our production servers will be pure CentOS, and its file system will be case sensitive.

Case sensitivity is one of the main reasons we wanted to have a local VM. We want to prevent "It works on my machine!"

Some workarounds we've considered or tried:

  • Use lsyncd to sync from the vagrant share to a location within the VM that is case sensitive
    • updating files on the host doesn't seem to generate the events in the VM that lsync listens to
  • Make a case-sensitive partition on the host
    • (Doesn't work for Windows)
  • Use samba
    • this may be an option, but we haven't vetted it yet.

Is there a better way? Note that we have developers using Windows, OS X, and Ubuntu, and the solution needs to work everywhere.

Best Answer

I worked around the issue on OS X by creating a sparse disk image in my project folder and formatted it to be case sensitive.

After mounting the sparse image, I moved my code onto it. Then replaced the original "src" folder with a symlink/alias to the mounted image. This way the shared folder is case sensitive inside the guest OS.

Definitely not the most elegant solution but it does close the gap between deployment and development environment which is why I started using Vagrant in the first place.

Perhaps a similar workaround could work for Ubuntu and Windows too?

Related Topic