linux - Mac OSX - Why is /dev/rdisk 20 times faster than /dev/disk

08
2014-07
  • spuder

    According to the rasbery pi documentation, You can load your OS to a flash card with either /dev/disk or /dev/rdisk.

    rdisk stands for raw disk.

    /dev/disk is a block level device, why would rdisk be 20 times faster?

    Using Mac OSX

    Note: In OS X each disk may have two path references in /dev: /dev/disk# is a buffered device, which means any data being sent undergoes extra processing. /dev/rdisk# is a raw path, which is much faster, and perfectly OK when using the dd program. On a Class 4 SD card the difference was around 20 times faster using the rdisk path.

  • Answers
  • Daniël W. Crompton

    From man hdiutil:

    /dev/rdisk nodes are character-special devices, but are "raw" in the BSD sense and force block-aligned I/O. They are closer to the physical disk than the buffer cache. /dev/disk nodes, on the other hand, are buffered block-special devices and are used primarily by the kernel's filesystem code.

    In layman's terms /dev/rdisk goes almost directly to disk and /dev/disk goes via a longer more expensive route


  • Related Question

    permissions - Why is the ownership for /dev/input/eventX set to "root"?
  • francesc

    Why are /dev/input/eventX permissions/ownership set to crw-r----- root.root? Then no unprivileged user application can program the mouse.

    According to what I've read it's due to security reasons, and I understand this. Yes, I also know that I can change eventX permissions via udev. But /dev/ttyX behavior is different, when not logged in, it is:

    crw------- root.root
    

    and once logged in, it becomes:

    crw------- francesc.tty
    

    Wouldn't it make sense to do the same for the mouse (/dev/input/whatever)? It seems a design inconsistency to me.

    What do you think?


  • Related Answers
  • Lee Hambley

    The mouse is a shared system hardware resource, and a tty is a local resource that a user can temporarily conjure into existence for personal use; I see no reason for the permission models to be similar)

    What problem is it you are trying to solve by using the mouse device directly?