#!/bin/sh # To test shrinking: INODES=8192, then ./realloc-inodes test-clean.img 2048 # To test growing: INODES=2048, then ./realloc-inodes test-clean.img 8192 FILE=${FILE:-test-ext4-grow1.img} FS=${FS:-ext4} SIZE=${SIZE:-32768} OPTS=${OPTS:--b 1024 -g 2048 -N 2048} dd if=/dev/zero of=$FILE bs=1k seek=$((SIZE-1)) count=1 /sbin/mkfs.$FS -F -m 0 $OPTS $FILE mkdir -p dir mount -o loop $FILE dir # For block moving test: create a sparse file with many extents dd if=/dev/urandom of=dir/f_random bs=1k count=1 for i in {1..2500}; do dd if=dir/f_random of=dir/f_sparse bs=1k count=1 seek=$((2400-i*2)) conv=notrunc 2>/dev/null done # For inode moving test: create 1201 1kb sized files dd if=/dev/zero of=dir/f_zero bs=1k count=1 for i in {1..1200}; do cp dir/f_zero dir/f$i done umount dir