LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-24-2014, 09:56 PM   #1
MisterBark
Member
 
Registered: Jul 2012
Location: Republic of Krakozhia
Distribution: Slackware & Zenwalk core + compile
Posts: 104

Rep: Reputation: 6
Question SLOW DISK: 100MB/s read but only 2MB/s write!


Hi!

I just setup a new server, good machine, and I experience a very slow write speed on the disk although the read is fine.

Below are all details.
THANK YOU!

Custom Kernel 3.14.4-grsec 32bit - Xeon (core-avx2)
XFS file systems.

DISK:
WDC WD1003FBYX-0

CONTROLLER:

Intel 8 Series/C220 Series Chipset Family 4-port SATA Controller 1 [IDE mode]

Code:
# hdparm -tT /dev/sda
/dev/sda:
 Timing cached reads:   22962 MB in  1.99 seconds = 11514.06 MB/sec
 Timing buffered disk reads: 242 MB in  3.01 seconds =  80.49 MB/sec
Code:
# iotop WHILE READING: (copy big file from disk to ramfs)
Total DISK READ :      99.82 M/s | Total DISK WRITE :       2.27 M/s
Actual DISK READ:      99.82 M/s | Actual DISK WRITE:    1744.35 K/s
Code:
# iotop WHILE WRITING: (copy big file from ramfs to disk)
Total DISK READ :     711.29 K/s | Total DISK WRITE :       3.03 M/s
Actual DISK READ:     711.29 K/s | Actual DISK WRITE:       2.47 M/s
Code:
root[www]# hdparm -i /dev/sda

/dev/sda:

 Model=WDC WD1003FBYX-01Y7B0, FwRev=01.01V01, SerialNo=WD-WCAW30617487
 Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=50
 BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=16
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=1953525168
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio3 pio4 
 DMA modes:  mdma0 mdma1 mdma2 
 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6 
 AdvancedPM=yes: unknown setting WriteCache=enabled
 Drive conforms to: Unspecified:  ATA/ATAPI-1,2,3,4,5,6,7

 * signifies the current active mode
 
Old 05-24-2014, 11:36 PM   #2
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Forget IDE mode. Go AHCI.
 
Old 05-25-2014, 07:16 AM   #3
MisterBark
Member
 
Registered: Jul 2012
Location: Republic of Krakozhia
Distribution: Slackware & Zenwalk core + compile
Posts: 104

Original Poster
Rep: Reputation: 6
Thank you but I'm sorry, I don't see how that could make the disk that slow in writing only!
 
Old 05-25-2014, 12:45 PM   #4
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
You may also have misaligned partitions.
 
Old 05-25-2014, 01:05 PM   #5
MisterBark
Member
 
Registered: Jul 2012
Location: Republic of Krakozhia
Distribution: Slackware & Zenwalk core + compile
Posts: 104

Original Poster
Rep: Reputation: 6
Right, I thought about that, but would the read speed still be so fast? (100MB/s)

Last edited by MisterBark; 05-25-2014 at 03:51 PM.
 
Old 05-25-2014, 05:42 PM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,770

Rep: Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210
Quote:
Originally Posted by MisterBark View Post
Right, I thought about that, but would the read speed still be so fast? (100MB/s)
Yes. Misalignment has negligible effect on read performance, but impacts write performance severely.
 
Old 05-25-2014, 11:36 PM   #7
MisterBark
Member
 
Registered: Jul 2012
Location: Republic of Krakozhia
Distribution: Slackware & Zenwalk core + compile
Posts: 104

Original Poster
Rep: Reputation: 6
Ah. Thank you.

Any thought on that:
Code:
# fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc8ecb330

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63    25189919    12594928+  83  Linux
/dev/sda2        25189920    58765769    16787925   82  Linux swap
/dev/sda3        58765770   226548629    83891430   83  Linux
/dev/sda4       226548630  1953520064   863485717+   5  Extended
/dev/sda5       226548693   394331489    83891398+  83  Linux
/dev/sda6       394331553  1953520064   779594256   83  Linux
 
Old 05-26-2014, 08:15 AM   #8
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,770

Rep: Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210
Quote:
Originally Posted by MisterBark View Post
Code:
Sector size (logical/physical): 512 bytes / 512 bytes
Alignment should not be an issue for that disk drive. Alignment is a concern only for drives with a 4K physical sector size.

Just to be sure the problem is really with the drive, turn off swap temporarily and try writing from /dev/zero to the swap partition.
Code:
swapoff /dev/sda2 && dd if=/dev/zero of=/dev/sda2 bs=1M seek=1 count=10K
swapon /dev/sda2
That "seek=1" leaves the swap header intact. Thus, no "mkswap" needed afterward.
 
Old 05-26-2014, 08:41 AM   #9
MisterBark
Member
 
Registered: Jul 2012
Location: Republic of Krakozhia
Distribution: Slackware & Zenwalk core + compile
Posts: 104

Original Poster
Rep: Reputation: 6
Code:
# swapoff /dev/sda2 && dd if=/dev/zero of=/dev/sda2 bs=1M seek=1 count=10K
^C166+0 records in
166+0 records out
174063616 bytes (174 MB) copied, 289.139 s, 602 kB/s
Very interesting, thank you!
I had to stop it because it would take forever.

During that, I was monitoring with iotop and the overall write speed of the disk never went over 3MB/s, usually 1-2MB/s.
 
Old 05-26-2014, 03:09 PM   #10
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Quote:
Sector size (logical/physical): 512 bytes / 512 bytes
Drive can present incorrect physical sector size and I'm pretty sure it is the case here.
 
Old 05-26-2014, 04:47 PM   #11
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,770

Rep: Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210
Quote:
Originally Posted by Emerson View Post
Drive can present incorrect physical sector size and I'm pretty sure it is the case here.
I looked up that model number on the WD website, and the specs there say the sector size is 512 bytes. Actually, the swap partition is properly aligned, so it should be possible to do some experimenting based on that (and the test I proposed above might not be meaningful).

And now that I notice the results in #9, I can only conclude that something seems seriously wrong with that drive. That test was doing I/O to a properly aligned partition. Let's see the output from "smartctl -A /dev/sda" and see if that reveals anything.

Last edited by rknichols; 05-26-2014 at 04:56 PM. Reason: And now that I notice ...
 
Old 05-26-2014, 04:55 PM   #12
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Well, that leaves IDE mode which should never be used with any POSIX compliant OS.
 
Old 05-26-2014, 05:55 PM   #13
MisterBark
Member
 
Registered: Jul 2012
Location: Republic of Krakozhia
Distribution: Slackware & Zenwalk core + compile
Posts: 104

Original Poster
Rep: Reputation: 6
Code:
# smartctl -A /dev/sda
smartctl 5.40 2010-10-16 r3189 [i486-slackware-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF READ SMART DATA SECTION ===
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x002f   200   200   051    Pre-fail  Always       -       0
  3 Spin_Up_Time            0x0027   184   172   021    Pre-fail  Always       -       3791
  4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       -       88
  5 Reallocated_Sector_Ct   0x0033   200   200   140    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x002e   200   200   000    Old_age   Always       -       0
  9 Power_On_Hours          0x0032   077   076   000    Old_age   Always       -       17371
 10 Spin_Retry_Count        0x0032   100   253   000    Old_age   Always       -       0
 11 Calibration_Retry_Count 0x0032   100   253   000    Old_age   Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       87
192 Power-Off_Retract_Count 0x0032   200   200   000    Old_age   Always       -       77
193 Load_Cycle_Count        0x0032   200   200   000    Old_age   Always       -       10
194 Temperature_Celsius     0x0022   106   103   000    Old_age   Always       -       41
196 Reallocated_Event_Count 0x0032   200   200   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0032   200   200   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0030   200   200   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age   Always       -       0
200 Multi_Zone_Error_Rate   0x0008   200   200   000    Old_age   Offline      -       0
NOTE: uptime is 6 hours (because I had a crash...)


.

Last edited by MisterBark; 05-26-2014 at 05:57 PM.
 
Old 05-26-2014, 07:04 PM   #14
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,770

Rep: Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210
System uptime is irrelevant. The drive accumulates those events internally whenever it is on.

Well, I'm at a loss to explain what is happening. Those SMART attributes all look excellent -- no bad sectors, nothing out of the ordinary. Unless some other process is pounding on the disk or /var/log/messages is overflowing with ATA error messages, I can't imagine what could be going on. Even if there were an alignment issue (which has been ruled out anyway), a 50:1 degradation would be beyond anything I've heard about. This is an ordinary internal disk, not part of some network storage or RAID array, right? By any chance is the BIOS set up for RAID, and writes are always waiting for a missing disk in the array?

Or, perhaps everything you write to the disk is first being sent to the NSA for inspection/audit??
 
Old 05-26-2014, 07:21 PM   #15
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Alright. I'm trying one more time. IDE mode is compatibility mode for Windows XP users so they can boot and install AHCI drivers. Quite clear it is not designed for performance ... ?
 
  


Reply

Tags
disk, hdparm, slow, write


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Fast read, Slow write? Samba. sysrez Linux - Networking 6 11-02-2010 08:46 AM
Slow read/write operations on 3592 drive Joejr4u Linux - Hardware 2 03-17-2008 05:25 AM
USB 2.0 slow write but fast read, solution yet? ArchNGEL Linux - Hardware 15 02-17-2008 01:33 PM
k3b - slow read, but fast write bob66 Linux - Software 5 05-13-2005 05:35 PM
9.2 slow on mmx200, 32 edo ram, 2mb vid ricdave Mandriva 5 12-18-2003 06:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration