If you ran the following, what would happen?
cat /dev/random > ~/randomFile # don't run
Would it be written until the drive runs out of space, or would the system see a problem with this and stop it (like with an infinite symlink loop)?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
It writes until the disk is full (usually there is still some space reserved for the root user). But as the pool of random data is limited, this could take a while.
If you need a certain amount of random data, use
dd if=/dev/random iflag=fullblock of=$HOME/randomFile bs=1M count=1
Other possibilities are mentioned in answers to a related question.
However, in almost all cases it is better to use
It does not block if the kernel thinks that it get out of entropy.
For better understanding, you can also read myths about /dev/urandom.
Installing haveged speeds up
/dev/random and also provides more entropy to
dd needs the
fullblock option as /dev/random (in opposite of
/dev/urandom) can return incomplete blocks if the entropy pool is empty.
dd does not support units, write them out:
dd if=/dev/random iflag=fullblock of=$HOME/randomFile bs=1048576 count=1