Is swap space used for the page cache, or can it be used for that?
8
votes
3
answers
1009
views
From my understanding, accessed files from disk are being kept in the page cache, for as long as there's enough memory left. Is this data also being moved to swap memory, or can this be facilitated?
**I have the following case:**
A Debian 12 VPS server with limited (4GB) RAM and fairly large SSD storage. It is accessing files on a mounted SMB share, which is located on another server, over the internet through wireguard (bottleneck).
Can I configure my VPS server so, that it caches as many of the files on the SMB share in local swap memory on it's SSD as possible? Or are there other tools to achieve this?
**edit**
grawity's solution worked flawlessly!
1.
apt install cachefilesd
2. Set RUN=yes
in /etc/default/cachefilesd
3. Optionally set cache dir in /etc/cachefilesd.conf
4. Restart daemon sudo systemctl restart cachefilesd.service
5. Mount SMB share with -o fsc
option
6. Monitor watch cat /proc/fs/fscache/stats
Asked by adrifromhh
(91 rep)
Aug 3, 2025, 08:04 AM
Last activity: Aug 4, 2025, 11:15 PM
Last activity: Aug 4, 2025, 11:15 PM