Skip to content

Instantly share code, notes, and snippets.

@johnko
Last active August 29, 2015 14:02
Show Gist options
  • Save johnko/313da7a8f3d74f8b1ad0 to your computer and use it in GitHub Desktop.
Save johnko/313da7a8f3d74f8b1ad0 to your computer and use it in GitHub Desktop.
Testing FreeBSD ZFS... Also, how to create millions of files... CAUTION, ONLY DO THIS ON A TEST SYSTEM
#!/bin/sh
#########################################
# CAUTION, ONLY DO THIS ON A TEST SYSTEM
#########################################
# use GELI to onetime encrypt 4 hard drives to test with
for i in `seq 0 3` ; do geli onetime /dev/ada$i ; done
# append the ELI devices to a DEV variable
for i in `seq 0 3` ; do DEV="$DEV /dev/ada$i.eli" ; done
# create a ZPOOL named test made up of a mirror of the encrypted devices
zpool create test mirror $DEV
# create a pseudo-random 1MB test file
dd if=/dev/urandom of=/test/0 bs=1m count=1
# copy said test file many times, to a new file using the numbers in a sequence
# this makes use of the l2arc cache
for i in `seq 1 4000000` ; do cp -v /test/0 /test/$i ; done
# or you can create pseudo random files
for i in `seq 1 4000000` ; do dd if=/dev/urandom of=/test/$i bs=1m count=1 ; echo $i ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment