Home | History | Annotate | Line # | Download | only in newfs_fsck
      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 #
     12 echo -n "making small files: "
     13 for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f
     14 do
     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
     22 done
     23 echo "done."
     24 
     25 echo "Sleeping for 10 seconds...."
     26 sleep 10
     27 
     28 echo "Trying with another half meg; expect 'no space on device'"
     29 dd if=/dev/zero of=$1/f61 bs=512 count=1024 >/dev/null || true
     30 sync
     31 df -h $1
     32