Subject: block- vs raw disk performance
To: None <netbsd-users@netbsd.org>
From: Martijn van Buul <martijnb@atlas.ipv6.stack.nl>
List: netbsd-users
Date: 04/12/2005 18:58:50
Could anyone please explain this to me:

atlas# dd if=/dev/sd0d of=/dev/null bs=128k count=1024
1024+0 records in
1024+0 records out
134217728 bytes transferred in 49.180 secs (2729111 bytes/sec)

versus

atlas# dd if=/dev/rsd0d of=/dev/null bs=128k count=1024
1024+0 records in
1024+0 records out
134217728 bytes transferred in 8.781 secs (15285016 bytes/sec)

sd0d is an USB disk:

ehci0 at pci2 dev 9 function 2: NEC USB Host Controller (rev. 0x04)
usb2 at ehci0: USB revision 2.0
uhub2 at usb2
uhub2: NEC EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
uhub2: single transaction translator
uhub2: 5 ports with 5 removable, self powered
[...]
umass0 at uhub2 port 5 configuration 1 interface 0
umass0: vendor 0x0000 product 0x0000, rev 2.00/0.00, addr 3
umass0: using SCSI over Bulk-Only
scsibus0 at umass0: 2 targets, 1 lun per target
sd0 at scsibus0 target 0 lun 0: <SAMSUNG, SP1604N, TM10> disk fixed
sd0: fabricating a geometry
sd0: 149 GB, 152627 cyl, 64 head, 32 sec, 512 bytes/sect x 312581809 sectors

The strange thing is that, during "normal" operations, the drive performs
quite fast, only marginally slower than the rsd0d case:

atlas# mount /dev/sd0e /mnt/spare2
atlas# dd if=/spare2/Image.nrg of=/dev/null bs=128k
4804+1 records in
4804+1 records out
629765292 bytes transferred in 42.016 secs (14988701 bytes/sec)

How come sd0d is so slow sometimes?