-
-
Save graysky2/c97f47b8f1a0f5d8ae3d664780ddf20d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## run as root | |
## NFS is your NFS mount | |
NFS=/scratch | |
if ! mountpoint -q "$NFS"; then | |
echo "$NFS should be a mounted NFS partition" | |
exit 1 | |
fi | |
for i in 1 2 3 4; do | |
IMG="$NFS/image.$i" | |
MP="$NFS/mp" | |
truncate -s 8G "$IMG" | |
mkfs.ext4 -F "$IMG" &>/dev/null | |
[[ -d "$MP" ]] || mkdir "$MP" | |
mount -o loop "$IMG" "$MP" | |
# write out 4G of random data to the mounted image | |
echo "Writting round $i" | |
#dd if=/dev/urandom of="$MP/rnd.$i" bs=4M count=1000 status=progress | |
dd if=/dev/zero of="$MP/rnd.$i" bs=4M count=1000 status=progress | |
ls -l "$MP" | |
echo "Round $i done" | |
umount "$MP" | |
rmdir "$MP" | |
rm -f "$IMG" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment