Skip to content

Instantly share code, notes, and snippets.

@eric-glb
Last active December 14, 2022 13:40
Show Gist options
  • Save eric-glb/2558082e403a88f47ab86f26351ce1c8 to your computer and use it in GitHub Desktop.
Save eric-glb/2558082e403a88f47ab86f26351ce1c8 to your computer and use it in GitHub Desktop.
Generate quickly 20GB of random data using openssl
#!/usr/bin/env bash
# Generate 20GB file of random data in /dev/shm (~ramdisk)
time openssl enc -aes-256-ctr \
-pass pass:"$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64)" \
-nosalt < /dev/zero 2>/dev/null |
dd bs=4M \
count=5120 \
status=progress \
iflag=fullblock \
of=/dev/shm/my_random_file
@eric-glb
Copy link
Author

eric-glb commented Dec 14, 2022

In a 6C/12T VM in Azure, 112GB RAM:

21466447872 bytes (21 GB) copied, 41.145581 s, 522 MB/s
5120+0 records in
5120+0 records out
21474836480 bytes (21 GB) copied, 41.1589 s, 522 MB/s

real	0m42.732s
user	0m12.757s
sys	0m57.393s
$ ls -lh /dev/shm/my_random_file 
-rw-rw-rw- 1 me me 20G Dec 14 13:22 /dev/shm/my_random_file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment