On Fri, Jul 05, 2019 at 11:49:02AM -0700, James Bottomley wrote: > > Create a series of 4kB files numbered sequentially, each 4kB in size > > until you fill the partition. Delete the even numbered ones. Create > > a 20MB file. > > Well, I know *how* to do it ... I was just hoping, in the interests of > creative laziness, that someone else had produced a script for this > before I had to ... particularly one which leaves more randomized gaps. You mean something like this? It doesn't do randomized gaps, since usually I'm trying to stress test block allocations. #!/bin/bash DEV=/dev/lambda/scratch SIZE=10M mke2fs -Fq -t ext4 -i 4096 -b 4096 $DEV $SIZE max=$(dumpe2fs -h $DEV 2>/dev/null | awk -F: '/^Free blocks:/{print $2}') mount $DEV /mnt cd /mnt mkdir -p d{0,1,2,3,4,5,6,7,8,9}/{0,1,2,3,4,5,6,7,8,9} seq 1 $max | sed -E -e 's;^([[:digit:]])([[:digit:]])([[:digit:]]);d\1/\2/\3;' > /tmp/files$$ cat /tmp/files$$ | xargs -n 1 fallocate -l 4096 2>/dev/null sed -ne 'p;n' < /tmp/files$$ | xargs rm -f cd / umount $DEV rm /tmp/files$$