How do I get an equivalent of /dev/one in Linux
Try this:
dd if=<(yes $'\01' | tr -d "\n") of=file count=1024 bs=1024
Substitute $'\377'
or $'\xFF'
if you want all the bits to be ones.
Well, you could do this:
dd if=/dev/zero count=1024 bs=1024 |
tr '\000' '\001' > file
tr '\0' '\377' < /dev/zero | dd bs=64K of=/dev/sdx
This should be much faster. Choose your blocksizes (or add counts) like you need at. Writing ones to a SSD-Disk till full with a blocksize of 99M gave me 350M/s write performance.
pv /dev/zero |tr \\000 \\377 >targetfile
...where \377
is the octal representation of 255
(a byte with all bits set to one). Why tr
only works with octal numbers, I don't know -- but be careful not to subconsciously translate this to 3FF.
The syntax for using tr
is error prone. I recommend verifying that it is making the desired translation...
cat /dev/zero |tr \\000 \\377 |hexdump -C
Note: pv
is a nice utility that replaces cat
and adds a progress/rate display.