Skip to content

Instantly share code, notes, and snippets.

@kwharrigan
Last active April 30, 2016 19:23
Show Gist options
  • Save kwharrigan/31d38aed44311cd5f96c35fd472bf604 to your computer and use it in GitHub Desktop.
Save kwharrigan/31d38aed44311cd5f96c35fd472bf604 to your computer and use it in GitHub Desktop.
Play around with inode allocation
# Example 1 - Remove file after every iteration... note inodes are
# often reused after each deletion
for i in {1..1000}; do
filename=/tmp/file$i
echo "Creating " $filename
echo "blahblah" > $filename
stat -c "%i" $filename
echo "Removing " $filename
rm $filename
done
# Example 2 - Create files, but don't remove until the end. Note inodes not often reused
for i in {1..1000}; do
filename=/tmp/file$i
echo "Creating " $filename
echo "blahblah" > $filename
stat -c "%i" $filename
done
for i in {1..1000}; do
filename=/tmp/file$i
rm $filename
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment