smallfiles revision 1.1 1 #!/bin/sh
2
3 #
4 # Create a bunch of small files at once, then delete most of them.
5 # This forces live blocks in nearly empty segments.
6 # If the filesystem is small enough, the cleaner will have to run in
7 # order for this to complete.
8 #
9 # Argument is directory in which to run.
10 #
11 for i in 0 1 2 3 4 5
12 do
13 for j in 0 1
14 do
15 # Quarter megabyte files, two at a time
16 # for a maximum of six at once
17 # (enough to force cleaning on a 2.88 disk)
18 dd if=/dev/zero of=$1/f$i$j bs=512 count=512 &
19 done
20 wait
21 sync
22 rm -f $1/f*1
23 df -k $1
24 ls -l $1
25 done
26
27 echo "Sleeping for 10 seconds...."
28 sleep 10
29
30 echo "Trying with another half meg"
31 dd if=/dev/zero of=$1/f61 bs=512 count=1024
32