Overlayfs #1301
-
Is it possible to define a synced folder in a Vagrantfile as an overlayfs in the VM? I am thinking about a use case such overlying /var/cache/dnf from the host to the guest VM at the same mount point to speed up dnf in the VM. Dan Walsh outlines an approach to do this for containers (https://www.redhat.com/sysadmin/speeding-container-buildah) and I was wondering about doing something similar in Vagrant. One approach might be a provisioning shell script to set up the overlay after the VM starts? thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I think what you are looking for is https://github.com/fgrehm/vagrant-cachier, although unmaintained, I believe it still works just fine. For VMs instead of an overlayfs, what is needed is a network filesystem that can be sync'ed between the host and guest. With the latest release of vagrant-libvirt it should be possible to use NFS, 9p, or virtiofs as the filesystem type. I've also made use of a shared volume that is not deleted when the VM is shutdown and reattached on boot and used some scripts to mount it under the path needed. Depends on which will work best for you. Main issue is typically locking and multiple machines, so I generally configure the caching to be per machine rather than per box, but unless you are using multi machine environments the per box setting should work just fine. It appears vagrant-cachier does have support for handling caching for dnf, but I've not checked to see if it's still matches what is defined in https://github.com/fgrehm/vagrant-cachier/blob/master/lib/vagrant-cachier/cap/redhat/dnf_cache_dir.rb |
Beta Was this translation helpful? Give feedback.
I think what you are looking for is https://github.com/fgrehm/vagrant-cachier, although unmaintained, I believe it still works just fine. For VMs instead of an overlayfs, what is needed is a network filesystem that can be sync'ed between the host and guest. With the latest release of vagrant-libvirt it should be possible to use NFS, 9p, or virtiofs as the filesystem type.
I've also made use of a shared volume that is not deleted when the VM is shutdown and reattached on boot and used some scripts to mount it under the path needed.
Depends on which will work best for you.
Main issue is typically locking and multiple machines, so I generally configure the caching to be per machine rather th…