{{tag>Brouillon FS Cache}}
= Disque cache flush sync io purge
Source :
* http://stackoverflow.com/questions/9551838/how-to-purge-disk-i-o-caches-on-linux
* https://www.kernel.org/doc/Documentation/sysctl/vm.txt
* https://en.wikipedia.org/wiki/Sync_(Unix)
''drop_caches.sh''
echo 3 |sudo tee /proc/sys/vm/drop_caches
#!/bin/bash
sync
echo 3 >/proc/sys/vm/drop_caches
swapoff -a && swapon -a
# (move data, modified through FS -> HDD cache) + flush HDD cache
sync
# (slab + pagecache) -> HDD (https://www.kernel.org/doc/Documentation/sysctl/vm.txt)
echo 3 > /proc/sys/vm/drop_caches
blockdev --flushbufs /dev/sda
hdparm -F /dev/sda
# Command that should be run before unplug, flushes everything guaranteed
echo 1 > /sys/block/sdX/device/delete
watch the progress of a `sync` operation
Source : http://unix.stackexchange.com/questions/48235/can-i-watch-the-progress-of-a-sync-operation
watch grep -e Dirty: -e Writeback: /proc/meminfo
awk '{print $9}' /sys/block/sda/stat