On my computer, which dual-boots Ubuntu 12.04 LTS (kernel 3.5) and Windows 7, the hard drive speed is very fast on Windows but very slow on Ubuntu. The slowness remains when I boot on an Ubuntu Live CD for 13.04 (kernel 3.8) and prerelease 13.10 (kernel 3.11). However, when I boot on Knoppix (kernel 3.9), the slowness goes away!
Anybody know why, or how it can be fixed in Ubuntu?
Here are the speeds using exactly the same hardware:
- Ubuntu 12.04 LTS, 13.04, 13.10: About 1 MB/sec, estimated using /bin/du while copying files.
- Windows 7: 168 MB/second as reported by Windows
- Knoppix: about the same as Windows, definitely over 100MB/sec
The slowness happens on both internal and external drives: the internal SSD RAID (3ware 9750-4i card), an internal Western Digital Red (not on the RAID card), and external drives using USB 3.0, Firewire, and eSATA.
This computer itself has a very fast 6-core CPU and 32 GB RAM, so computer power is not an issue. It's a brand new computer so it's possible something is configured wrong.
Trivia: Originally, I thought the problem was limited to USB 3.0, and my vendor (endpcnoise.com) guessed that the ASmedia chipset on my computer is the culprit, because Ubuntu's support for it is "rudimentary at best."
Some timing info: it takes 15 seconds to copy a 20 MB file to/from ANY DISK in the system. Here's the SSD RAID on Ubuntu 13.04 Live CD:
$ time cp bigfile bigfile2
real 0m14.866s
user 0m0.000s
sys 0m0.056s
When I boot into Knoppix,the problem completely goes away:
$ time cp bigfile bigfile2
real 0m0.034s
user 0m0.000s
sys 0m0.013s
When I run dmesg /var/log/syslog before and after a copy like this, no additional messages get written. (See full dmesg output.) But I do see a few messages relating to the SSD being tested:
...
[ 0.882760] LSI 3ware SAS/SATA-RAID Controller device driver for
Linux v3.26.02.000.
[ 0.883566] ahci 0000:00:1f.2: version 3.0
[ 0.883643] ahci 0000:00:1f.2: irq 80 for MSI/MSI-X
[ 0.889807] e1000e: Intel(R) PRO/1000 Network Driver - 2.0.0-k
[ 0.889809] e1000e: Copyright(c) 1999 - 2012 Intel Corporation.
[ 0.891377] xor: automatically using best checksumming function:
[ 0.899068] ahci 0000:00:1f.2: AHCI 0001.0300 32 slots 6 ports 6 Gbps
0x31 impl SATA mode
[ 0.899071] ahci 0000:00:1f.2: flags: 64bit ncq sntf pm led clo pio
slum part ems apst
[ 0.899074] ahci 0000:00:1f.2: setting latency timer to 64
...
[ 1.234773] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[ 1.234785] ata7: SATA link down (SStatus 0 SControl 300)
[ 1.234802] ata6: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
[ 1.234820] ata5: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
...
[ 1.990817] sd 0:0:0:0: Attached scsi generic sg3 type 0
[ 1.990833] sd 0:0:0:0: [sdb] 1874978816 512-byte logical blocks: (959 GB/894 GiB)
[ 1.993034] sd 0:0:0:0: [sdb] Write Protect is off
[ 1.993036] sd 0:0:0:0: [sdb] Mode Sense: 23 00 10 00
[ 1.993158] sd 0:0:0:0: [sdb] Write cache: enabled, read cache: enabled, supports DPO and FUA
[ 1.995812] sdb: sdb1 sdb2 sdb3 sdb4 < sdb5 >
[ 2.000255] sd 0:0:0:0: [sdb] Attached SCSI disk
[ 2.292132] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: (null)
...
[ 9.428287] 3w-sas: scsi0: ERROR: (0x03:0x0101): Invalid command opcode:opcode=0x85.
The last line is explained here.
Does this point to a root cause?
hdparm reports identical results on Ubuntu 12.04 and Knoppix, except for -Q (queue_depth), but changing it on Ubuntu had no noticeable effect:
$ sudo hdparm -acdgkmurABCMNQW /dev/sda
/dev/sda:
multcount = 16 (on)
IO_support = 1 (32-bit)
readonly = 0 (off)
readahead = 256 (on)
geometry = 364801/255/63, sectors = 5860533168, start = 0
look-ahead = 1 (on)
APM_level = not supported
drive state is: active/idle
acoustic = not supported
max sectors = 5860533168/5860533168, HPA is disabled
queue_depth = 31 (Knoppix had value = 1, but changing on Ubuntu didn't help)
write-caching = 1 (on)
Here is lshw:
$ sudo lshw -c bus
*-core
description: Motherboard
product: P9X79
vendor: ASUSTeK COMPUTER INC.
physical id: 0
version: Rev 1.xx
serial: 130410781200420
slot: To be filled by O.E.M.
*-usb:0
description: USB controller
product: X79 series chipset USB2 Enhanced Host Controller #2
vendor: Intel Corporation
physical id: 1a
bus info: pci@0000:00:1a.0
version: 06
width: 32 bits
clock: 33MHz
capabilities: pm debug ehci bus_master cap_list
configuration: driver=ehci_hcd latency=0
resources: irq:23 memory:fb627000-fb6273ff
*-usb
description: USB controller
product: ASM1042 SuperSpeed USB Host Controller
vendor: ASMedia Technology Inc.
physical id: 0
bus info: pci@0000:06:00.0
version: 00
width: 64 bits
clock: 33MHz
capabilities: msi msix pm pciexpress xhci bus_master cap_list
configuration: driver=xhci_hcd latency=0
resources: irq:17 memory:fb400000-fb407fff
*-usb
description: USB controller
product: ASM1042 SuperSpeed USB Host Controller
vendor: ASMedia Technology Inc.
physical id: 0
bus info: pci@0000:07:00.0
version: 00
width: 64 bits
clock: 33MHz
capabilities: msi msix pm pciexpress xhci bus_master cap_list
configuration: driver=xhci_hcd latency=0
resources: irq:19 memory:fb300000-fb307fff
*-firewire
description: FireWire (IEEE 1394)
product: VT6315 Series Firewire Controller
vendor: VIA Technologies, Inc.
physical id: 0
bus info: pci@0000:09:00.0
version: 01
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress ohci bus_master cap_list
configuration: driver=firewire_ohci latency=0
resources: irq:17 memory:fb100000-fb1007ff ioport:b000(size=256)
*-usb:1
description: USB controller
product: X79 series chipset USB2 Enhanced Host Controller #1
vendor: Intel Corporation
physical id: 1d
bus info: pci@0000:00:1d.0
version: 06
width: 32 bits
clock: 33MHz
capabilities: pm debug ehci bus_master cap_list
configuration: driver=ehci_hcd latency=0
resources: irq:23 memory:fb626000-fb6263ff
*-serial UNCLAIMED
description: SMBus
product: X79 series chipset SMBus Host Controller
vendor: Intel Corporation
physical id: 1f.3
bus info: pci@0000:00:1f.3
version: 06
width: 64 bits
clock: 33MHz
configuration: latency=0
resources: memory:fb624000-fb6240ff ioport:f000(size=32)
Best Answer
I switched from my current kernel, 32-bit PAE, to a 64-bit kernel. Disk writes are now fast. This was with Ubuntu 13.04.
Moral of the story: if you have more than 4GB RAM, use 64-bit Linux. Even though the PAE kernel may work, it may also have problems like this.