# External USB drive pauses system under heavy IO



## Draad (Feb 4, 2010)

I have installed a fresh FreeBSD 8.0/amd64 to an external USB drive.

I have an UFS2 filesystem on there with softupdates enabled.
But now when there is heavy IO for example while extracting a port the system pauses for a few seconds every once and while and then continues on without any problem. No error pops up anywhere. I have no problems while doing normal IO. There are no other devices connected to the usb bus.

Anybody got any idea what might be going on?

Boot information:


```
ehci0: <Intel 82801GB/R (ICH7) USB 2.0 controller> mem 0xfbeffc00-0xfbefffff irq 23 at device 29.7 on pci0
ehci0: [ITHREAD]
usbus4: EHCI version 1.0
usbus4: stop timeout 
usbus4: <Intel 82801GB/R (ICH7) USB 2.0 controller> on ehci0  
usbus4: 480Mbps High Speed USB v2.0   
ugen4.2: <Western Digital> at usbus4 
umass0: <Western Digital External HDD, class 0/0, rev 2.00/1.75, addr 2> on usbus4
umass0:  SCSI over Bulk-Only; quirks = 0x0000 
umass0:3:0:-1: Attached to scbus3
<WD 15EADS External 1.75> Fixed Direct Access SCSI-4 device
da0: 40.000MB/s transfers
da0: 1430799MB (2930277168 512 byte sectors: 255H 63S/T 182401C)
```


----------



## fronclynne (Feb 4, 2010)

I get the same behaviour on an old, slow 1.8" ata133 drive.  I don't think the physical medium can keep up with the bus.  I could be wrong though.  You might try mounting the partition(s) in question async (this is considered unsafe, but hasn't caused any problems for me *yet*).


----------



## Draad (Feb 4, 2010)

That doesnÂ´t seem to make any difference. There is just an enormous difference in the responsiveness of the system when using the USB drive, the internal SATA disks hardly slow the system down and when using usb everything comes to a crawl. The basic speed doesnÂ´t seem the problem


```
SATA:
dd if=/test/1000mb.bin of=test
2048000+0 records in
2048000+0 records out
1048576000 bytes transferred in 35.995881 secs (29130444 bytes/sec)

USB:
dd if=/test/1000mb.bin of=test
2048000+0 records in
2048000+0 records out
1048576000 bytes transferred in 48.017753 secs (21837257 bytes/sec)
```

But when I unpack something the results are very different probably due that it also needs the cpu? But I have a pentium duo t2160 1.8ghz which should be more than enough for this.


```
SATA:
tar xjf firefox-3.5.7.source.tar.bz2  22.41s user 3.41s system 53% cpu 48.560 total

USB:
tar xjf firefox-3.5.7.source.tar.bz2  23.05s user 3.17s system 5% cpu 8:21.44 total
```


----------



## Nicholas (Feb 5, 2010)

I also have a problem with external USB HDD. Writing to it just gets stuck at various moments.

`# dd if=/dev/zero of=/dev/da0 bs=1m` successfully finishes on linux and Haiku OS, but not on my FreeBSD box  (Exits with I/O error)

```
FreeBSD lettuce 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Fri Dec  4 04:05:12 MSK 2009
```


----------



## Draad (Feb 7, 2010)

Ok, I was looking for the solution to this problem in all the wrong places. First I took the disk out of its enclosement and put it in my computer as a normal SATA disk. This did not solve the problem but I learned the exact disk type.

WDC WD15EADS-11P8B1 80.00A80

After some browsing around the internet I learned that the disk used a new 4096 byte sector size which the storage industry is moving to. So the normal disk partitions created by sysinstall are misaligned. So I used gpart with a GTP scheme to create a partition that started at sector 64 instead of sector 63. This speeded up things an awful lot, it still not the fasted disk on the books because it is a "green disk", but the performance is now at least adequate. 

So I moved my install to another disk and just use this one for bulk storage. While doing this I encountered a problem with partitions created by the 8.0-RELEASE install, it did not want to boot from these disks. The FreeBSD bootloader just gave the message "invalid partition" and then stopped booting. I solved this by creating the partition with an older version of FreeBSD I had lying around (6.3-RELEASE). So now I am enjoying FreeBSD 8.0 at a decent speed.


----------



## fronclynne (Feb 11, 2010)

Weird.  I'll have to keep that in mind for when I finally buy a new disk.


----------



## Nicholas (Feb 11, 2010)

*External HDD problem.*

[ post merged in - Mod ]

May I just post a link here:
http://old.nabble.com/Some-questions-about-da0-on-USB2-(recent-bad-behaviour)-td26035971.html

I'm encountering exactly the same problems (My external WD Passport just hangs when writing/reading). Something is really broken in 8.0- (Both release and stable).

`# dd if=/dev/zero of=/dev/da0 bs=1m` exits with "Input/Output error" whenever it wants 

I tried Frenzy LiveCD (with FreeBSD 6.3) - everything worked fine.
I remember not having the problem on 8-PRERELEASE.

Thanks for listening.


----------



## Draad (Feb 15, 2010)

In my case it was my HD causing problems and that led to the problems while it was connected through USB. Maybe your disk is having a problem too. Can you read the SMART information by using the smartctl program in the smartmontools port?

btw, I wasn't the only one having problems with the 4kb sector size

slashdot story on the same problem in linux


----------



## Nicholas (Feb 15, 2010)

Don't think so. My disk is ok. Works in 7.3 and other operating systems, excepting FreeBSD 8.0-RELEASE+


----------



## Nicholas (Feb 17, 2010)

I csupped RELENG_8 yesterday (I was on 201001 snapshot) and built system again, then successfully copied lots of data. Disk seems to work fine.


----------

