11.1Sperseant#!/bin/sh
21.1Sperseant
31.1Sperseant#
41.2Sperseant# Create a bunch of small files at once, then delete half of them.
51.2Sperseant# The file size is less than the segment size.
61.2Sperseant# This forces live blocks in half-empty segments.
71.1Sperseant# If the filesystem is small enough, the cleaner will have to run in
81.1Sperseant# order for this to complete.
91.1Sperseant#
101.1Sperseant# Argument is directory in which to run.
111.1Sperseant#
121.2Sperseantecho -n "making small files: "
131.2Sperseantfor i in 0 1 2 3 4 5 6 7 8 9 a b c d e f
141.1Sperseantdo
151.2Sperseant	echo -n "$i "
161.1Sperseant	for j in 0 1
171.1Sperseant	do
181.2Sperseant		dd if=/dev/zero of=$1/f$i$j bs=65536 count=1 >/dev/null 2>&1
191.1Sperseant	done
201.1Sperseant	sync
211.1Sperseant	rm -f $1/f*1
221.1Sperseantdone
231.2Sperseantecho "done."
241.1Sperseant
251.1Sperseantecho "Sleeping for 10 seconds...."
261.1Sperseantsleep 10
271.1Sperseant
281.2Sperseantecho "Trying with another half meg; expect 'no space on device'"
291.2Sperseantdd if=/dev/zero of=$1/f61 bs=512 count=1024 >/dev/null || true
301.2Sperseantsync
311.2Sperseantdf -h $1
32