Read, write to USB disk cache

Could you tell me how to purge, clear, the USB disk read/write cache with command line on ssh session.

If you are going to extract the drive, the "mount" command will not finish untill all pending writes have finished.

Otherwise, there exists the "fsync" system call, and the "sync" command.

Not exactly my purpose;
After write, I want to purge the cache to measure the read time with disk access.
I don't think the sync/fsync will purge the RAM cache I think it will copy the data in the disk.

Yes, fsync will force pending writes to the drive, but it will also retain the cache in RAM. I do not know of a specific command to delete the cache, but unmounting the drive will surely have that effect.

I found it here
It's working for Openwrt

Many thanks


free -m
              total        used        free      shared  buff/cache   available
Mem:         511968      185620       28996         332      297352      285400
Swap:             0           0           0
~# sync; echo 3 > /proc/sys/vm/drop_caches
~# free -m
              total        used        free      shared  buff/cache   available
Mem:         511968      182460      323880         332        5628      304768
Swap:             0           0           0

1 Like

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.