brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: fincore shows how much of a file sits in the page cache

Cache
~/tips/tip-fincore-file-in-page-cache

fincore /var/lib/example/data.db

See whether a file is being served from RAM or still from disk.

Linux keeps recently used files in memory, which is why the second read is often much faster. free gives the total. This tool, part of util-linux, tells me about one specific file.

fincore /var/lib/example/data.db

The output has the columns RES (bytes of the file that are in memory), PAGES, SIZE and FILE. When RES is close to SIZE, the whole file is cached. You can give it several files at once, and choose columns:

fincore --bytes -o RES,SIZE,FILE *.db

Use it to understand odd timings. If a benchmark is suddenly fast on the second run, check whether the test file was simply sitting in memory. Or see which of your database or media files the system has actually kept around.

I read the answer as a snapshot. The kernel can drop those pages a moment later when something else needs the RAM, and that is normal behaviour, nothing to fix. On Ubuntu releases where the command is missing, look for it in the util-linux-extra package. It reports on regular files you can open, so you may need sudo.

Further reading: fincore(1) man page

Going deeper: Keep a domain pointed at your home with Cloudflare DDNS on Unraid

More Cache tips npm cache verify fc-cache -f -v ~/.local/share/fonts proxy_cache app; Cache-Control: no-cache Cache-Control: max-age=60, stale-while-revalidate=600 All Cache tips (24) All topics

Link