[nylug-talk] questions about /dev/null
Sunny Dubey
sunny at opencurve.org
Mon Nov 5 06:30:29 EST 2007
On Monday 05 November 2007 02:04:03 am Judd Maltin wrote:
> Is there any reason writing a stream of ASCII to /dev/null would be
> faster than copying the same file to /dev/null ?
>
> And then int he context of MySQL, why would it be faster to do a
> mysqldump into /dev/null than to do a mysqlhotcopy into /dev/null -
> faster by 1/2 the time.
>
> Odd, odd. Is it inodes? For some reason not reading smoothly across
> the disk?
This is a common misconception.
/dev/null is a *file*. It is a special file and not a regular one:
sunny at localhost ~ $ file /dev/null
/dev/null: character special (1/3)
Writing *TO* /dev/null causes no disk activity because you are writing to a
file that simply discards the information. Writing *ON* /dev/null causes
disk activity because now you have replaced the file with something else that
does not discard the information, and actually grows with whatever you are
writing on it.
You can think of /dev/null as a garbage pail with a bottomless pit. You could
throw everything at it, and it would simply "disappear". But the moment you
replace it with not something special, a garbage mound would start to grow.
HTH
--
Sunny Dubey
mail: sunny at audiowiki.org
tele: 212.333.3542
More information about the nylug-talk
mailing list