Very slow copying Ubuntu 12.10, AHCI
I have two disks, SSD (Samsung 830 128GB) and normal HDD (WD 1TB) and Ubuntu 12.10 installed. AHCI enabled in the BIOS. I have a problem with extremely slow copying in all directions (Samsung->Samsung, WD->WD, WD->Samsung and Samsung->WD).
Let me describe what I did:
sudo hdparm -Tt /dev/sda
The result more or less ok:
Timing cached reads: 16678 MB in 2.00 seconds = 8358.48 MB/sec
Timing buffered disk reads: 1362 MB in 3.00 seconds = 453.96 MB/sec
When copying by cp
or in the midnight commander i was getting transfers only around 1MB/s!
Started reading a bit and after disabling the write cache with
hdparm -W 0 /dev/sda
The speed reaches the crazy speed of 60MB/s, wchich still is nothing for operation inside the SSD drive.
Both drives are connected to SATA 3 sockets in the motherboard. FYI: Copying from USB Pendrive goes much faster, so it looks like read speed problem. The problem doesn't occur with Windows. I paste the dmesg below:
[ 4898.720381] ata1.00: configured for UDMA/133 [ 4898.720387] ata1: EH complete
[ 4898.720509] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[ 4983.122199] ata2.00: configured for UDMA/133
[ 4983.122205] ata2: EH complete
[4983.122315] sd 1:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
Do you have any ideas what may be wrong?
It looks like your partitions are not aligned to the erase block boundary in the case of SSD, and to the sector boundary in the case of HDD. This is why the problem manifests when copying, which involves writing to one of the drives, but not when just reading from the drive.
WD Caviar HDDs have 4096 byte sectors, but expose 512 byte sectors to the BIOS to increase "compatibility". The default partitioning in Ubuntu will not align the partitions to 8 sectors, which will cause every write to be translated by the drive's 512 byte sector emulation to a read-and-rewrite. This will completely kill the performance.
SSDs typically have erase page sizes between 128kB and 1024kB. It's best to align the partitions to a multiple of 1024kB.
Typically fdisk
uses a sector size of 512. This means your HDD partitions should start at sectors which are a multiple of 8 and the SSD partitions at sectors which are a multiple of 2048. Note that on you boot drive, the first partition should be at least 64kB from the start of the drive, so that the GRUB boot image can fit between the MBR and the first partition.
To sum up, you need to repartition and reformat your drives. Use fdisk -u /dev/sda
from a LiveCD to set up partitions which start at multiples of 2048 sectors. After setting up the partitions, you can use Ubuntu's installer to format them.