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