FreeBSD + Vantec NexStar 3

A few days ago, I added an entry to the FreeBSD Developers Want List indicating that I would like to have a large hard drive and USB-attachable enclosure, in order to permit me to perform backups in a more sane manner. Santa (aka. Daniel Seuffert) provided me with a 250GB Seagate Barracuda 7200.9 SATA2 hard drive and a Vantec NexStar 3 USB 2.0 enclosure, and since several people were curious as to how well this hardware was supported by FreeBSD, I thought I should provide a brief report.

The good: It works. I installed the drive into the enclosure, plugged in the power, and plugged the USB cable into my Dell D600 laptop, and FreeBSD 6.0-RELEASE-p4 recognized it immediately:

Jan 27 19:07:15 hexahedron kernel: umass0: Sunplus Technology Inc. USB to Serial-ATA bridge, rev 2.00/c4.fd, addr 2
Jan 27 19:07:15 hexahedron kernel: da0 at umass-sim0 bus 0 target 0 lun 0
Jan 27 19:07:15 hexahedron kernel: da0: <ST325082 4AS > Fixed Direct Access SCSI-2 device
Jan 27 19:07:15 hexahedron kernel: da0: 40.000MB/s transfers
Jan 27 19:07:15 hexahedron kernel: da0: 238475MB (488397168 512 byte sectors: 255H 63S/T 30401C)
I could then read and write to /dev/da0 just like I would any other 250GB hard drive. I could partition it, label it, create filesystems on it -- everything Just Worked.

The bad: It is a bit slow. USB 2.0 can, in theory, transmit data at 60MB/s, while according to StorageReview the Seagate drive has a transfer rate varying from 34.4 MB/s to 62.0 MB/s. In contrast, the transfer rate I obtained via USB was constant at approximately 25 MB/s across the entire drive.

FreeBSD's diskinfo -c explains the reason for the poor performance: command overhead. In contrast to my laptop's hard drive, where there is an overhead cost of 97 microseconds for a single read request, the USB-attached drive has an overhead cost of 730 microseconds. I imagine that this increased cost is largely due to the USB<-->SATA translation, but also partly due to my laptop's poor interrupt routing -- the USB controller is sharing IRQ 11 with several other devices, and the FreeBSD kernel needs to pick up the Giant lock to handle each interrupt.

The ugly: FreeBSD doesn't handle removal of drives very gracefully. When I unplug the USB cable, FreeBSD recognizes that the device is gone -- but if there is a filesystem mounted from the device, that filesystem remains mounted. FreeBSD doesn't want to unmount the filesystem, since it thinks the underlying device is busy; but at the same time you (obviously) can't do anything with that filesystem. If you ask FreeBSD to forcibly unmount the filesystem -- or if FreeBSD shuts down, at which point it forcibly unmounts every filesystem -- then it will panic.

I imagine that this could be fixed by teaching the kernel to forcibly unmount filesystems at the point when their underlying device is being removed (but before freeing the data structures associated with the device), but I'm not comfortable enough in the FreeBSD kernel to try to make that sort of change myself. In any case, there is a very simple answer to unplugging the drive while it has a filesystem mounted: Don't do that!

Posted at 2006-01-28 17:10 | Permanent link | Comments
blog comments powered by Disqus

Recent posts

Monthly Archives

Yearly Archives


RSS