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