Skip to content

Instantly share code, notes, and snippets.

@labeneator
Created October 11, 2013 16:23
Show Gist options
  • Save labeneator/6937753 to your computer and use it in GitHub Desktop.
Save labeneator/6937753 to your computer and use it in GitHub Desktop.
# Show the mountpoint for the loopbacked fs
mount |grep zero;
# Meminfo stats
cat /proc/meminfo | egrep -i "dirty|cache";
# Give humans a chance to run dd in another window
echo -e "\n**Sleeping for 10.. Waiting for I/O**\n";
sleep 10;
# Meminfo stats
cat /proc/meminfo | egrep -i "dirty|cache";
echo -e "\n****\n";
# What does the world look like if we view the loopback fs via VFS (which effectively get it's results from the pagecache)
ls -lisa /tmp/bah;
echo -e "\n****\n";
# Meminfo stats
cat /proc/meminfo | egrep -i "dirty|cach|buff";
echo -e "\n****\n";
# What the actual backing file has (Reading the <real> disk data)
echo ls -l | /sbin/debugfs /tmp/zeros;
echo -e "\n\n****\n";
# How much of our backing file is in the pagecache
echo -e "\n****\n";
fincore /tmp/zeros;
# Kicking out the file from the pagecache
echo -e "\n****\n";
fadvise /tmp/zeros POSIX_FADV_DONTNEED;
# More stats
echo -e "\n****\n";
cat /proc/meminfo | egrep -i "dirty|cach|buff";
# Wake up pdflush and wait for it to flush dirty pages to the <real> hard disk
sync;
echo -e "\n*** Sleeping for 10.***\n";
sleep 10;
echo -e "\n****\n";
# Show whether we were able to evict the backing file from the page cache
fincore /tmp/zeros;
echo -e "\n****\n";
# Read the backing file contents
echo ls -l |/sbin/debugfs /tmp/zeros ;
echo -e "\n****\n";
# Last bunch of stats
cat /proc/meminfo | egrep -i "dirty|cach|buff";
echo -e "\n****\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment