ls -l, I found a series of devices like
ram1 etc. I looked at the output closely and (for example)
brw------- 1 root root 1, 3 Jan 6 11:34 /dev/ram3 crw-rw-rw- 1 root root 1, 3 Jul 15 1970 /dev/null
Hmmm, they only differs by device type (block and character). I tried reading and writing to
ram3, but to my surprise, I can read a 8 MiB block of zero bytes from it, and I can't write more than 8 MiB to it, as I thought I could immediately receive an EOF when reading and could write infinitely to it.
I then tried other
rams, but more surprisingly they all behave the same.
/dev/ram8 doesn't generate random stuffs like
/dev/ram7 doesn't report "disk full" like
Then I tried
mknod-ing everything in my working directory (mount type: ext4), and the results are the same: character devices behave the same as
/dev/null,full,zero,random and block devices same as
So I started wondering:
- How is
/dev/<device>with the same device number?
- How to explain the 8 MiB empty stuff (all zero) when read and 8 MiB write limit for those block devices?
I guess the answers should apply to all Linux-kernel systems.
(Side note: 8 MB = 8,000,000 bytes and 8 MiB = 8,388,608 bytes)