Skip to content

Instantly share code, notes, and snippets.

@Callisto13
Created March 1, 2019 16:14
Show Gist options
  • Save Callisto13/aee3ec7d11a6b575642c7f0b7a9860a3 to your computer and use it in GitHub Desktop.
Save Callisto13/aee3ec7d11a6b575642c7f0b7a9860a3 to your computer and use it in GitHub Desktop.
#!/bin/sh
mountandwrite() {
i=$1
echo "mounting $i"
mount -t overlay -o lowerdir=./lower,upperdir=./upper$i,workdir=./work$i overlay target$i
echo "writing $i"
dd if=/dev/urandom of=target$i/foo bs=10M count=10
}
unmount() {
i=$1
echo "unmounting $i"
start_time=$(date +"%s.%N")
umount target$i
end_time=$(date +"%s.%N")
result="$(echo $end_time-$start_time | bc)"
echo "$i took $result seconds to unmount"
}
mkdir lower
for i in `seq 1 10`; do
mkdir upper$i work$i target$i
mountandwrite $i
done
for i in `seq 1 10`; do
unmount $i &
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment