View previous topic :: View next topic |
Author |
Message |
trumee Guru
Joined: 02 Mar 2003 Posts: 551 Location: London,UK
|
Posted: Sat Feb 09, 2008 2:06 pm Post subject: Speed sucks with SATA as compared to IDE |
|
|
Guys,
I have a SATA disk with gentoo and an IDE disk with windows installed.
Here are my disks
Code: |
#fdisk -l
Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 18236 146480638+ 83 Linux
/dev/sdb2 18237 36472 146480670 83 Linux
/dev/sdb3 36473 37445 7815622+ 82 Linux swap / Solaris
/dev/sdb4 37446 60801 187607070 83 Linux
Disk /dev/sdd: 81.9 GB, 81964302336 bytes
255 heads, 63 sectors/track, 9964 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 * 1 9963 80027766 7 HPFS/NTFS
|
The windows disk is mounted with ntfs-3g driver.
I tried to compare the write performance by copying a file on my usb disk to both these drives.
Code: |
To IDE NTFS drive
~ $ time cp /media/FREECOM\ HDD/file.raw /mnt/windows/
real 0m44.619s
user 0m0.024s
sys 0m3.416s
To SATA ext3 drive
~ $ time cp /media/FREECOM\ HDD/file.raw ./
real 1m3.432s
user 0m0.000s
sys 0m6.712s
|
The SATA drive is so much slower!!!! Interesting hdparm still shows that SATA i faster
Code: |
desktop rs4 # hdparm -t /dev/sdb /dev/sdd
SATA
/dev/sdb:
Timing buffered disk reads: 242 MB in 3.00 seconds = 80.66 MB/sec
IDE
/dev/sdd:
Timing buffered disk reads: 142 MB in 3.02 seconds = 47.09 MB/sec
|
I am on 2.6.24 kernel amd64 and my SATA drive is Samsung HD501LJ. An pointers what might me wrong? |
|
Back to top |
|
|
frostschutz Advocate
Joined: 22 Feb 2005 Posts: 2977 Location: Germany
|
Posted: Sat Feb 09, 2008 2:27 pm Post subject: |
|
|
All you measure with cp is the file system cache (i.e. when cp is done the data was not actually completely copied yet). The result would be more interesting if you umounted the partition you copied the file onto directly after the cp. This will force the data to be actually written on disk, i.e. total time to write data is cp + time it takes to umount.
Also, where are you copying from? Depending on the source media file system cache can again influence the result in a bad way (the second copy operation may take the data to be written from cache, instead of having to read it from a disk). Also the source medium should be faster than both of your disks and not used by any other processes. It's probably better to just use /dev/zero as a source instead of an actual file.
For example try: time (dd if=/dev/zero of=/mnt/partition/file bs=1M count=1000; umount /mnt/partition)
This should write 1000 Megabytes of zeroes to each disk and measure the total time. |
|
Back to top |
|
|
PaulBredbury Watchman
Joined: 14 Jul 2005 Posts: 7310
|
Posted: Sat Feb 09, 2008 3:02 pm Post subject: Re: Speed sucks with SATA as compared to IDE |
|
|
trumee wrote: | Interesting hdparm still shows that SATA is faster |
That's because using cp as a speed test is ridiculous - see phrase "disk cache". RAM is hugely faster than disk. |
|
Back to top |
|
|
juhah n00b
Joined: 03 Oct 2004 Posts: 46
|
Posted: Sun Feb 10, 2008 11:28 am Post subject: |
|
|
frostschutz wrote: | For example try: time (dd if=/dev/zero of=/mnt/partition/file bs=1M count=1000; umount /mnt/partition) |
no need to umount. sync will do. also, sync'ing right before the benchmark is a good thing to do.
Code: | # sync; time (dd if=/dev/zero of=/mnt/partition/file bs=1M count=1000; sync) |
|
|
Back to top |
|
|
frostschutz Advocate
Joined: 22 Feb 2005 Posts: 2977 Location: Germany
|
Posted: Sun Feb 10, 2008 11:57 am Post subject: |
|
|
juhah wrote: | no need to umount. sync will do. |
sync will sync everything, not just the specific volume though, so it may do too much if there is disk activity going on elsewhere. That's why I suggested unmounting instead, as it affects the partition only. |
|
Back to top |
|
|
irgu Tux's lil' helper
Joined: 25 Apr 2003 Posts: 131
|
Posted: Wed Feb 13, 2008 8:59 pm Post subject: |
|
|
Ext3's file allocaton is block based meanwhile NTFS's is extent based (like ext4). This means that when the file grows then ext3 will use much more CPU and write speed is decreasing.
I have found that writing huge files (many GB) is always faster using ntfs3g than ext3 on the *same* device. So I guess your problem is file system, not SATA related. Try XFS, that must be at least as fast as ntfs3g. |
|
Back to top |
|
|
|