hoytech / vmtouch

Portable file system cache diagnostics and control
https://hoytech.com/vmtouch/
BSD 3-Clause "New" or "Revised" License
1.79k stars 210 forks source link

inconsistent filesystem traversing #106

Open leszekeljasz opened 11 months ago

leszekeljasz commented 11 months ago

Hello!

Thank you for this lovely tool. Just spotted this behaviour that does not seem to be desired. Here's my situation, a Linux server with two mounts: / and /var/www/virtualmin:

root@web01:/# df -h | grep -vE 'snap|run|udev|tmpfs'
Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p1   39G   16G   24G  40% /
/dev/nvme1n1     30G   25G  4.7G  85% /var/www/virtualmin

When I use vmtouch against /, it indicates total pages ~ 16G which aligns with filesystem usage on the / mount - so looks like vmtouch skips the mount in /var/www/virtualmin:

root@web01:/# vmtouch / 2>&1 | grep -v WARNING
           Files: 544678
     Directories: 47977
  Resident Pages: 209724/4307663  819M/16G  4.87%
         Elapsed: 47.997 seconds

But when I execute it against all files in / (skipping some), it indicates total pages as 39GB which more or less aligns with total filesystem usage on both / and /var/www/virtualmin, so in this variant it includes the mount:

root@web01:/# vmtouch $(ls -d /* | grep -vE 'dev|sys|proc|snap|run') 2>&1 | grep -v WARNING
           Files: 819215
     Directories: 103000
  Resident Pages: 305073/10413686  1G/39G  2.93%
         Elapsed: 45.924 seconds

Is this expected? My linux version: 5.4.0-1103-aws.