xref: /netbsd-src/regress/sys/fs/lfs/newfs_fsck/smallfiles (revision eb7c1594f145c931049e1fd9eb056a5987e87e59)
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#
11for i in 0 1 2 3 4 5
12do
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
25done
26
27echo "Sleeping for 10 seconds...."
28sleep 10
29
30echo "Trying with another half meg"
31dd if=/dev/zero of=$1/f61 bs=512 count=1024
32