#!/bin/sh # # Create a bunch of small files at once, then delete half of them. # The file size is less than the segment size. # This forces live blocks in half-empty segments. # If the filesystem is small enough, the cleaner will have to run in # order for this to complete. # # Argument is directory in which to run. # echo -n "making small files: " for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f do echo -n "$i " for j in 0 1 do dd if=/dev/zero of=$1/f$i$j bs=65536 count=1 >/dev/null 2>&1 done sync rm -f $1/f*1 done echo "done." echo "Sleeping for 10 seconds...." sleep 10 echo "Trying with another half meg; expect 'no space on device'" dd if=/dev/zero of=$1/f61 bs=512 count=1024 >/dev/null || true sync df -h $1