I am working on characterizing an SSD drive to determine max TBW / life expectancy.
Currently I am using BASH to generate 500MB files with random (non-zero) content :
dd if=<(openssl enc -aes-128-cbc -pass pass:"$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64)" -nosalt < /dev/zero) of=/media/m2_adv3d/abc${stamp1} bs=1MB count=500 iflag=fullblock&
Note : {stamp1} is a time stamp for ensuring unique file names.
I am looking to accomplish the same result in Python but am not finding efficient ways to do this (generate the file quickly).
Looking for suggestions.
Thanks!
Update
I have been experimenting with the following and seem to have achieved 2 second write; files appear to be random and different :
import os
newfile = open("testfile.001", "a")
newfile.write (os.urandom(500000000)) # generate 500MB random content file
newfile.close ()
A little skeptical that this is truly good enough to stress an SSD. Basically going to infinitely loop this; once drive is full, deleting to oldest file and writing new one, and collecting SMART data every 500 files written to trend the aging.
Thoughts?
Thanks,
Dan.
The os.urandom option works best for generating large random files.