I want a directory to be fast to read from, like on tmpfs for some time.

The closest thing is this:

vmtouch -L -m 2G /path/to/mydir

But this does not detect new or deleted files.

  • Maybe you wand anything-sync-daemon, it uses an overlay between your data and a tmpfs Your data is in a tmpfs, and is efficiently synced back to the hdd (only whats changed). The kernel has support for the overlay filesystem, anything-sync-daemon mounts a tmpfs and your dir in the overlay, it then efficiently syncs back changes (thanks to the overlayfs). This might be helpful: wiki.archlinux.org/index.php/… – VaTo May 18 '15 at 1:53

Implemented workaround: https://gist.github.com/vi/77717d7076618af92344

Mirrored here:


# vmtouchpoll: Keep some files locked in memory (including new files, dropping deleted files)

# Usage: vmtouchpoll '/path/to/some/files/*.idx'

# Works by periodically restarting vmtouch with a new set of files
# Implemented by Vitaly "_Vi" Shukela in 2015, License=MIT

F=($(eval echo $1))

vmtouch -L -m 2G "${F[@]}"&

trap 'kill $P1; [[ $P2 -gt 0 ]] && kill $P2' EXIT

while true; do
    sleep 55;
    F=($(eval echo $1))

    vmtouch -q -L -m 2G "${F[@]}"&

    sleep 5;
    kill $P1

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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