It is possible to obtain the searched result in the following two known but not searched ways:
dd if=/dev/zero of=/path/to/mounted/partition/my_file.txt bs=64k
But would it be possible to use to use shred as a source for zeros or random data and write this as a file to a hard disk?
Shred can be used in the following way to create a data stream, but not write it to a file yet.
sudo shred -n 0 -v -z /dev/sdXX
Perhaps its possible to write a file with shred in a way like this:
sudo shred -n 0 -v -z > my_file.txt
I’m interested asking this question for these reasons:
I like to compare the speed of different ways to fill a disk by a file. It can be, useing as source
/dev/zerohave the 25x speed than/dev/urandom,srandomis up to 150x faster than/dev/urandom. Perhaps using shred as source, will be much faster than/dev/urandomtoo?See follow: Why is GNU shred faster than dd when filling a drive with random data?
srandomis still not available on some systems, but shred looks available to most systems. So it can possibly used as a fast alternative to/dev/zeroand/dev/urandom